I have implemented new Navigation view in navigation drawer. Now I want to hide and show the logout menu item on several login and logout condition.
here is my menu item of navigation view
<group android:checkableBehavior="single">
<item
android:id="@+id/home"
android:checked="false"
android:icon="@drawable/drawer_ic_home"
android:title="@string/home_string" />
<item
android:id="@+id/offer_coffee"
android:checked="false"
android:icon="@drawable/drawer_ic_offer_coffee"
android:title="@string/offer_coffee_string" />
<item
android:id="@+id/share_coffee"
android:checked="false"
android:icon="@drawable/drawer_ic_share_coffee"
android:title="@string/share_coffee_string" />
<item
android:id="@+id/take_coffee"
android:checked="false"
android:icon="@drawable/drawer_ic_take_coffee"
android:title="@string/take_coffee_string" />
<item
android:id="@+id/offer_status"
android:checked="false"
android:icon="@drawable/drawer_ic_coffee"
android:title="@string/offer_status"
/>
<item
android:id="@+id/about_us"
android:checked="false"
android:icon="@drawable/drawer_ic_about_us"
android:title="@string/about_us_string" />
<item
android:id="@+id/logout"
android:checked="false"
android:icon="@drawable/logout"
android:title="@string/logout" />
</group>
I want to hide the Logout item if I am not login and if I am login then I want to show this sub menu.
I have seen several links but they all are working on group of items but in my case I have to access single sub menu item named Logout in the group .