Android Question AppCompat toolbar menu - "menu_opened" event?

Misterbates

Active Member
Licensed User
I'm using the AppCompat library to replace the standard Action bar as described in https://www.b4x.com/android/forum/t...3-using-a-toolbar-as-actionbar.49053/#content.

It all works as documented and I can dynamically adjust the menu items as needed.

I was wondering if there was any way I could detect when the user touches the "more" icon to open the menu, as I'd like to cancel some other ongoing UI activity at that point, rather than at the point where the user chooses a menu item. Is there anything like a "menu_opened" event?

Thanks.
 
Change the menu Java code to:
Code: Copy
Private Sub Activity_MenuOpen
   Log("MenuOpen")
End Sub

#If Java

public boolean _onCreateOptionsMenu(android.view.Menu menu) {
  if (processBA.subExists("activity_createmenu")) {
  processBA.raiseEvent2(null, true, "activity_createmenu", false, new de.amberhome.objects.appcompat.ACMenuWrapper(menu));
  return true;
  }
  else
  return false;
}
  @Override
  public boolean onMenuOpened(int featureId, android.view.Menu menu) {
     if (menu != null) {
       processBA.raiseEvent(null, "activity_menuopen");
     }
  return super.onMenuOpened(featureId, menu);
  }
#End If
 
Upvote 0
Change the menu Java code to:
Code: Copy
Private Sub Activity_MenuOpen
   Log("MenuOpen")
End Sub

#If Java

public boolean _onCreateOptionsMenu(android.view.Menu menu) {
  if (processBA.subExists("activity_createmenu")) {
  processBA.raiseEvent2(null, true, "activity_createmenu", false, new de.amberhome.objects.appcompat.ACMenuWrapper(menu));
  return true;
  }
  else
  return false;
}
  @Override
  public boolean onMenuOpened(int featureId, android.view.Menu menu) {
     if (menu != null) {
       processBA.raiseEvent(null, "activity_menuopen");
     }
  return super.onMenuOpened(featureId, menu);
  }
#End If


Hello, can't take even on close ???? i found something on internet, and i try to use but dont work
Code: Copy
@Override
public void onPanelClosed(int featureId, Menu menu) {
    ...
}

Thank !!!
 
Upvote 0
Do NOT make duplicate posts
 
Upvote 0
Back
Top