I am not sure to understand what you want to do but if the aim is to have the submenu look and feel when you press on a button, you can programmatically call openContextMenu to achieve that. It uses the same menu classes, and a context menu looks exactly the same as a sub-menu.
2008/11/24 plusminus <[EMAIL PROTECTED]> > > I want to do so, because the ui-button is just a "hot-button" to some > existing functionality in a submenu. > > Looks like I'll double-implement it using a SingleChoice-AlertDialog > (its just some more or less trivial code) > > Best Regards, > plusminus > > On Nov 24, 6:07 am, Guillaume Perrot <[EMAIL PROTECTED]> wrote: > > I don't think this is the right thing to do. > > A good UI should not pop the panel menu programmatically, meaning by > > that the user didn't press the menu button and does not expect the > > panel to pop (and probably doesn't want to). > > You may consider using context menus instead. > > For example if you want a context menu to be popped when the user > > performs a long click on an entry, just call in onCreate: > > registerForContextMenu(someView); > > (If you implemented an OnLongClickListener on this view, be sure to > > return false not to interfere with the menu, by returning true, the > > menu won't pop but you can manually pop it by calling > > openContextMenu). > > > > Then override Activity.onCreateContextMenu(ContextMenu, View, > > ContextMenuInfo) > > and Activity.onContextItemSelected(MenuItem) > > > > On Nov 24, 6:24 am, plusminus <[EMAIL PROTECTED]> wrote: > > > > > Hi guys, > > > > > anyone knows how to open asubmenuusing code? > > > > > I only know how to open the menu itself using this snippet: > > > this.getWindow().openPanel(Window.FEATURE_OPTIONS_PANEL, new KeyEvent > > > (KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MENU)); > > > > > Regards, plusminushttp://anddev.org > > > # Worlds largest Android Development Community / Tutorials > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---