setListNavigationCallbacks is used to allow the user to switch between different views of the current screen easily via the ActionBar, as shown here and here.
I've noticed it got deprecated as of API21 (Lollipop), and that all the documentation says is to look for other navigation solutions, but it doesn't say what's the best one that fits the same point:
This method is deprecated. Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.
All other functions/classes that are related to this function are also deprecated, such as setNavigationMode, OnNavigationListener, ActionBar.NAVIGATION_MODE_LIST .
The navigation drawer is for navigation of different screens, and not different views of the same screen.
adding an action item that will provide a way to switch between the modes, but that's a bit weird...
using a ViewPager, but that's also weird as it doesn't really switch views, plus it takes more space.
Using tabs, but I think that's also deprecated in some way, plus it takes more space this way.
What should be the best alternative to this way of navigation?
Android ActionBar is a menu bar that runs across the top of the activity screen in android. Android ActionBar can contain menu items which become visible when the user clicks the “menu” button.
This post explains why not only list-, but ALL navigation modes have been deprecated. It became too difficult to make it able to customize Actionbar's navigations. Toolbar is the new Actionbar (also available in the appcompat-v7 support library). However, you won't find these methods there either. Instead, you need to supply your own optional (navigation) view(s). Then you can use it like a normal view in your layout.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With