Created
March 16, 2012 23:53
-
-
Save aim-up/2053693 to your computer and use it in GitHub Desktop.
NoMethodError: undefined method `width' for nil:NilClass
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ruboto/activity' | |
require 'ruboto/widget' | |
require 'ruboto/util/toast' | |
ruboto_import_widgets :Button, :TextView, :RelativeLayout | |
$activity.start_ruboto_activity "$sample_activity" do | |
setTitle 'Droidemo: A Ruboto Experiment' | |
def on_create(bundle) | |
self.content_view = | |
relative_layout(:id => 41, :layout => {:width= => :fill_parent}) do | |
@text_view = text_view :id => 42, | |
:text => 'Greetings, Outlander.' | |
@button = button :id => 43, | |
:text => "Pickpocket this NPC", | |
:width => :wrap_content, | |
:on_click_listener => @pick_pocket | |
end | |
#end | |
end | |
@pick_pocket = proc do |view| | |
@text_view.text = 'Guards! Arrest this thief.' | |
@button.text = 'Activate Stealth' | |
toast '24 Gold added.' | |
@button.on_click_listener = @activate_stealth | |
end | |
@activate_stealth = proc do |view| | |
@text_view.text = "Hey! Where'd he go?" | |
@button.text = "Pickpocket this NPC" | |
toast 'You disappear into nearby shadows.' | |
@button.on_click_listener = @pick_pocket | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment