I have a menu in NavigationView that have 7 menu items, some of these menu items should be invisible based on user settings and the remaining visible items should be displayed in different order. the items are already defined in the XML menu layout.
I've googled a lot but nothing related to already defined menu items. most of the solutions was suggesting to create the menu items in code and set the order while creating it.
here is my menu items XML layout:
<group android:checkableBehavior="single">
<item
android:id="@+id/Home_menuitem"
android:title="Home" />
<item
android:id="@+id/Register_menuitem"
android:title="Register" />
<item
android:id="@+id/Login_menuitem"
android:title="Login" />
<item
android:id="@+id/language_menuitem"
android:title="Language" />
<item
android:id="@+id/ContactUs_menuitem"
android:title="Contact Us" />
<item
android:id="@+id/Likes_menuitem"
android:title="Likes" />
<item
android:id="@+id/Subscription_menuitem"
android:title="Subscription" />
<item
android:id="@+id/Logout_menuitem"
android:title="Logout" />
</group>
say I want to change the order in Code (NOT in XML) to make "Likes_menuitem" to be displayed above "Home_menuitem"