As I understand it lightly, the hosting of tabs in the actionbar was obsolete in API 21. I still do not understand very well because (if someone explains it better I thank) but what I can do is adapt. I did a search and found some alternatives like Sliding Tabs from Google Play with ViewPager, although I have never used ViewPager because Actionbar.Tab served me very well.
But I have some problems and doubts in the implementation because this tool seems to be very good for static tabs. The case is that my app has very dynamic tabs. Because it is a chat app with every conversation being displayed by a fragment, new tabs pop up and are removed at all times.
I was not able to align ViewPager strategy very well with this scenario. I noticed that the way the adapter identifies the selected tab is very different from the actionbar tablistener, and I also did not find methods that added or removed tabs on the adapter or SlidingTabs. I thought about storing the fragments in an Arraylist to be used by the adapter but I do not know if the adapter would identify when I removed or added a fragment from there. Another issue that dynamizes the tabs is that users' nicknames related to the conversation are displayed on them, and that nick can also change at any time. I'm not sure when the getPageTitle () method is called.
Thinking about these differences I decided to come here to ask for help because maybe there is even a better alternative to this case that I do not yet know or some good practice that leaves this scenario viable.
Any help is welcome. Thanks in advance.