I've recently run into this issue as well, where I was relying on
MenuInfo containing the AdapterContextMenuInfo (for position in the
ListView) on the submenu.

The only workaround I've found so far is to store the MenuInfo in a
member variable while the context menu is open, and release it
onContextMenuClosed:


        // Member variable for keeping track of the MenuInfo between submenus
of a ListView's items
        private AdapterContextMenuInfo lastMenuInfo = null;

        public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo)
        {
                // Keep track of the current MenuInfo
                lastMenuInfo = (AdapterContextMenuInfo) menuInfo;
        }

        public boolean onContextItemSelected(MenuItem menuItem)
        {
                AdapterContextMenuInfo info = (AdapterContextMenuInfo)
menuItem.getMenuInfo();
                if (info == null)
                {
                        // Grab it from the member placeholder.  If this is 
still null,
it's a bug (?)
                        info = lastMenuInfo;
                }
        }

        public void onContextMenuClosed(Menu menu)
        {
                // We don't need it anymore
                lastMenuInfo = null;
        }



On Mar 2, 1:40 pm, TreKing <[email protected]> wrote:
> Thought I'd bring this back up one more time (maybe getting a Google
> Engineer to comment on this) before I submit this as a bug.
>
> This also holds true for AdapterView.AdapterContextMenuInfo.
>
> Thanks.
>
> -------------------------------------------------------------------------------------------------
> TreKing - Chicago transit tracking app for Android-powered 
> deviceshttp://sites.google.com/site/rezmobileapps/treking

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
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

Reply via email to