It's normal and expected. The menu is a global menu and not a contextual menu. If you want to perform contextual actions, either use a long press + contextual menu on a ListView item or use ListView's choice mode.
On Tue, Jan 27, 2009 at 2:23 AM, Tote <tot...@gmail.com> wrote: > > I have a ListActivity backed by an Adapter, which is NOT a > SimpleCursorAdapter, but an extension of BaseAdapter. I create my own > view in the adapter's GetView() method, which builds up a list on-the- > fly. > > Now I have a menu structure when this list is in focus. This menu > structure contains a submenu, too, and I have noticed that the > ListActivity's getSelectedItemPosition() returns -1 when I reach this > submenu. I also noticed that this value is correct when I activate the > top-level menu item that eventually "opens" the submenu (I queried the > afore-mentioned function in onMenuItemSelected() and it was fine). But > when onMenuItemSelected() gets called after the activation of a sub- > menu item getSelectedItemPosition() always returns -1. > > Can anyone point out if my expectation is wrong to assume that a list > selection shall not change when it's behind other UI components? Is it > a bug in the system? How shall I overcome it? I could implement dirty > tricks such as saving the position temporarily for a later query, but > I'd like to know first if I'm doing something wrong and/or if it's a > system malfunction. > > Thanks for your help in advance, > > Tote > > > > -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~---------~--~----~------------~-------~--~----~ 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 android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---