Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Self-Destructing Message Android App Using Fragments for Tabs Modifying Tabs from the Template

Alejandro Crespo
Alejandro Crespo
6,628 Points

My solution to the problems with deprecated code.

I saw a lot of people having trouble with this and I thought I would share my experience, I hope it helps. What I did to get past all the deprecated code is study what is current and apply that. If you are having trouble setting up the ActionBar, then set up a toolbar. You need to create a separate xml file for the toolbar. Then, in the MainActivity xml, include the toolbar with the <include/> tags. You need to then get the code on github of the SlidingTabLayout.java and SlidingTabStrip.java files. Create a class for each and paste the code provided. Then, in the MainActivity xml, below the toolbar you included, add the SlidingTabLayout and a ViewPager. Now you need to create the tabs. Create an xml file for each tab, by this I mean what you want to see once you click the tab. Also, you need to create the classes for the tabs, so you can inflate their view. There is more, but it is hard to explain without the actual code, here is a super simple,yet helpful, link that will take care of your headaches. I hope this helps someone.

http://www.exoguru.com/android/material-design/navigation/android-sliding-tabs-with-material-design.html

Kevin Gonzales
Kevin Gonzales
4,638 Points

So the way ben does it is outdated now correct? because I was going to do the steps he does, but if it is not the current way of doing it i rather learn by using the current stuff (which it sounds like you did)