iBobb iBobb - 18 days ago 10
Android Question

NavigationView, a way to uncheck previous selections?

Yesterday I followed 2 tutorials to implement the

NavigationView
component for my Drawer instead of using a
ListView
. Since it's a lot smarter, I was wondering if there's an integrated way of keeping track which item is selected and when you select a new one, the old selection is removed?

Or should we implement that logic? Should I just keep 2 integers with the ID of the selected element, one
oldSelection
and one
newSelection
and uncheck the old one?

Suggestions are welcome, thank you!

The tutorials:

http://www.viralandroid.com/2015/08/android-navigation-drawer-view.html
https://github.com/codepath/android_guides/wiki/Fragment-Navigation-Drawer

Answer

NavigationView does that for you , whenever u select a new item old item is removed and new is selected.

Note:

That this wont work for subMenu if u add any