how to call context menu

Posted by gdonald on Stack Overflow See other posts from Stack Overflow or by gdonald
Published on 2009-12-21T21:00:29Z Indexed on 2010/05/28 1:11 UTC
Read the original article Hit count: 175

Filed under:

I open my context menu like this:

 private OnClickListener optionsClickListener = new OnClickListener()
 {
  public void onClick( View v )
  {
    registerForContextMenu( v );
    openContextMenu( v );
  }
 };

How can I call

registerForContextMenu( v );
openContextMenu( v );

from inside my regular menu handler here:

 public boolean onOptionsItemSelected( MenuItem item )
 {
  switch( item.getItemId() )
  {
    case OPTIONS:
      registerForContextMenu( v );
      openContextMenu( v );
      return true;

where I have no View to pass?

© Stack Overflow or respective owner

Related posts about android