android developer
android developer

Reputation: 116010

What should be used instead of "setListNavigationCallbacks"?

Background

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.

The problem

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 .

What I've tried

  1. The navigation drawer is for navigation of different screens, and not different views of the same screen.

  2. adding an action item that will provide a way to switch between the modes, but that's a bit weird...

  3. using a ViewPager, but that's also weird as it doesn't really switch views, plus it takes more space.

  4. Using tabs, but I think that's also deprecated in some way, plus it takes more space this way.

The question

What should be the best alternative to this way of navigation?

Upvotes: 6

Views: 2038

Answers (1)

Coen B
Coen B

Reputation: 715

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.

Upvotes: 1

Related Questions