I'm using AndroidX Navigation architecture and want to know is it possible to replace the ActionBar menu completely or not?
In the project, in the Menu directory, there is a home.xml file that contains a menu items:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/homeMainMenu">
<item
android:id="@+id/action_inbox"
android:icon="@drawable/ic_baseline_mail_outline_24"
android:title="@string/action_inbox"
app:showAsAction="ifRoom" />
<item android:icon="@drawable/ic_baseline_more_vert_24"
android:title="@string/app_name"
app:showAsAction="always">
<menu>
<item
android:id="@+id/action_exitapp"
android:icon="@drawable/ic_baseline_exit_to_app_24"
android:title="@string/action_exit"
app:showAsAction="never" />
</menu>
</item>
</menu>
I want to create another menu XML file like mymenu.xml and on the fragment replace it with the home menu. Because of some reason don't want to replace items. Is it possible? If "Yes" how to handle item click?