Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (34 sloc) 1.181 kb
#######################################################
#
# demo-ruboto-core-sample.rb
#
# Mirrors the default script generated by ruboto-core.
#
#######################################################
require 'ruboto/activity'
require 'ruboto/widget'
require 'ruboto/util/toast'
ruboto_import_widgets :Button, :LinearLayout, :TextView
class SampleActivity
def on_create(bundle)
super
set_title 'Domo arigato, Mr Ruboto!'
self.content_view =
linear_layout :orientation => :vertical do
@text_view = text_view :text => 'What hath Matz wrought?', :id => 42,
:layout => {:width => :match_parent},
:gravity => :center, :text_size => 48.0
button :text => 'M-x butterfly', :layout => {:width => :match_parent},
:id => 43, :on_click_listener => proc { butterfly }
end
rescue
puts "Exception creating activity: #{$!}"
puts $!.backtrace.join("\n")
end
private
def butterfly
@text_view.text = 'What hath Matz wrought!'
toast 'Flipped a bit via butterfly'
end
end
$irb.start_ruboto_activity "SampleActivity"
Jump to Line
Something went wrong with that request. Please try again.