How to get menues working

31 views
Skip to first unread message

ssteidte

unread,
Feb 3, 2013, 7:33:19 PM2/3/13
to rub...@googlegroups.com
What is the best way to create a menu? 
With recent Ruboto versions I have code like
class MyActivity
  def on_create(bundle)
    ...
  end
  def def on_create_options_menu(menu)
    ...
  end
end

... but no menu is created. on_create_menu_options doesn't seem to get called at all this way.


Uwe Kubosch

unread,
Feb 3, 2013, 7:36:26 PM2/3/13
to rub...@googlegroups.com
Hi!

Have you tried the menu tutorial?

https://github.com/ruboto/ruboto/wiki/Tutorial%3A-Add-a-menu

I noticed a double "def" in your example, but that is probably just a typo in the email.
> --
> You received this message because you are subscribed to the Google Groups "Ruboto (JRuby on Android)" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ruboto+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
Uwe Kubosch
u...@kubosch.no
http://kubosch.no/




Scott Moyer

unread,
Feb 3, 2013, 7:44:50 PM2/3/13
to rub...@googlegroups.com

I think the problem is that onCreateOptionsMenu gets called before the app starts, and won't get called again (on versions of the OS that have the ActionBar).

Have your initial activity's onCreate open up a new activity and then call finish.

ssteidte

unread,
Feb 3, 2013, 9:04:10 PM2/3/13
to rub...@googlegroups.com
This does the trick.
Reply all
Reply to author
Forward
0 new messages