Ejemplo n.º 1
0
 /// <summary>Invokes the item by calling various listeners or callbacks.</summary>
 /// <remarks>Invokes the item by calling various listeners or callbacks.</remarks>
 /// <returns>true if the invocation was handled, false otherwise</returns>
 public bool invoke()
 {
     if (mClickListener != null && mClickListener.onMenuItemClick(this))
     {
         return(true);
     }
     if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(), this))
     {
         return(true);
     }
     if (mItemCallback != null)
     {
         mItemCallback.run();
         return(true);
     }
     if (mIntent != null)
     {
         try
         {
             mMenu.getContext().startActivity(mIntent);
             return(true);
         }
         catch (android.content.ActivityNotFoundException e)
         {
             android.util.Log.e(TAG, "Can't find activity to handle intent; ignoring", e);
         }
     }
     if (mActionProvider != null && mActionProvider.onPerformDefaultAction())
     {
         return(true);
     }
     return(false);
 }