Monday, April 29, 2013

[android-developers] Re: Context sub-menu opened-closed-reopened by itself!?

A pity no-one replied.

Anyway, I decided to get rid of the sub-menu and on item selection, open a new context menu. Only issue was to actually keep it open, and I had to delay the opening of the sub-menu.

The following got rid of the flickering and ensured the sub-menu remained open. Had to use a spare hidden view to open the new context menu though.

if (id == R.id.menu_item_for_sub_menu)
{
new Handler().postDelayed(new Runnable()
{
@Override
public void run() 
{
View v = vg.findViewById(R.id.fake_view_for_context);
if (v != null)
{
registerForContextMenu(v);
openContextMenu(v);
unregisterForContextMenu(v);
}
}
}, 0);
}

--
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment