0

seems that starting Lollipop the ActionBar "setNavigationMode" method is deprecated. i know that google now offers to use sliding tabs and view pager however I am unable to understand the code completely. is there any alternative that I can use? if there isnt then can someone suggest for a good tutorial on that?

I need to achieve two tabs when each one holds a fragment.

user2145673
  • 363
  • 1
  • 9
  • 23

2 Answers2

0

I am thinking of the same thing since I want to support the new Lollipop. There is a Stackoverflow link at Action bar navigation modes are deprecated in Android L

Let me know what you found or decided. Perhaps we can work together. Have fun!

Community
  • 1
  • 1
The Original Android
  • 6,147
  • 3
  • 26
  • 31
  • Hi!, I am currently working on somthing and I manged to bring sliding tabs and view pager togather, I just need to figure out now how I can bring my old fragments to the view pager and modified the code for my purpose. all this after two days of troublshooting the appcompact-v7 build issues. – user2145673 Jan 29 '15 at 15:45
  • Try to use this link https://gist.github.com/eluleci/199be9a0d1af42653b5b import the code to your project, it should give you a good start. BTW if you have any quick way to add my fragment to the view pager I would appriciate your help] – user2145673 Jan 29 '15 at 15:46
  • @user21- The code you're referencing uses the deprecated TabListener. For your convenience, look at http://developer.android.com/reference/android/app/ActionBar.TabListener.html . I notice this tab method listener too but for now, I am still hesitant to use it since I still want to support Lollipop as well. – The Original Android Jan 29 '15 at 19:09
  • OK, I'm a bit confused. How come they say that it is deprecated since 21 however on http://developer.android.com/training/implementing-navigation/lateral.html#horizontal-paging they show an example with that deprecated it.? I managed to apply the code I suggested on lollipop and it ran with no issues – user2145673 Jan 29 '15 at 20:23
  • @user21, I too was confused. Google showed an example which will be deprecated in the near future (forgive them), within 2 years the new smartphones will have Lollipop. However...I find your comment interesting about the new Lollipop. Is your app working fine on a Lollipop smartphone/tablet? Appreciate your answer on this. – The Original Android Jan 29 '15 at 20:33
  • Yes, that's why I was surprised to see that tablistener is deprecated. I will be able to upload some I. Ages – user2145673 Jan 29 '15 at 20:36
  • Sorry, wrong button:-), anyhow, I will upload some images tomorrow – user2145673 Jan 29 '15 at 20:37
  • @user21- Your sample code uses SlidingTablayout technique which is currently not deprecated. So most of your code seems fine anyway. But SlidingTablayout makes ActionBar (or the new Toolbar) useless, or not so useful. – The Original Android Jan 29 '15 at 20:37
0

I plan on using the SlidingTabsLayout technique instead of the new ActionBarCompat or Toolbar. It seems you don’t like it when reading from your original post. However there is sample working code at SlidingTabsBasic.
If you download the zip file, you may have to import the project instead of opening it. When you import, find the build.gradle file of the project. So far it seems this is not much difference than the link you posted at Github https://gist.github.com/eluleci/199be9a0d1af42653b5b.

I predict when the new Toolbar is stable, I can integrate some of this code like the ViewPager and PageAdapter.

Andrei T
  • 2,985
  • 3
  • 21
  • 28
The Original Android
  • 6,147
  • 3
  • 26
  • 31