1

I am new to android and recently used a android template (Tabbed activity - with ViewPager and fragments) and noticed that the ActionBar and ActionBar.TabListener are deprecated. So I replaced the ActionBar with AppCompatActivity as it is recommended, but Now I am wondering what should I use instead of the TabListener. Can I use onClickListener nested class in the Toolbar class ?

Node: The app works fine with the deprecated interface, but I want to use an interface that is not.

public class MainActivity extends AppCompatActivity implements ActionBar.TabListener {

This is a screenshot of my app enter image description here

Georgi Koemdzhiev
  • 11,421
  • 18
  • 62
  • 126

1 Answers1

5

I would recommend you to use Material Design tabs. It will use ViewPager and almost same. The advantage is, Material tabs are actual tabs.

When you use ActionBar.TabListener (deprecated), it is not actually tabs. They are actually actionbar tabs, which.. if you will rotate the screen, it will place themselves automatically on ActionBar on top. read the documentation here

Adding Navigation Tabs

So implement Material Design, which is new and best solution for tabs. To get started, i guess this is the best tutorial

Material Design Tabs

Ajay P. Prajapati
  • 1,973
  • 1
  • 17
  • 34