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


Anything that has to do with ActionBar and Tabs is deprecated. Why? and how would i fix this. Android Studio.

The app doesn't run anymore it crashes instantly. I am guessing that the deprecated stuff that has appeared everywhere has something to do with it? Am I right? How do i fix this? NAVIGATION_MODE_TABS, setNavigationMode, setSelectedNavigationItem, .addTab, .newTab,

This is some of it:


    final ActionBar actionBar = getSupportActionBar();

    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

    mViewPager = (ViewPager) findViewById(R.id.pager);

    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        public void onPageSelected(int position) {

    for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {


Ive got this line in the beggining of the Activity:


public class MainActivity extends ActionBarActivity implements ActionBar.TabListener { '''

ActionBarActivity, .TabListener


There have been a lot of API level changes in Android lately. Could you post your code so that we can give you specific help for your issues?

2 Answers

Sorry if this is extremely messy. Getting to know this site.


I think I'm understanding which of the deprecations you are running into. One post here on Treehouse where another forum user goes over their fix for the problem can be found here. I have not tried it out personally so I cannot say how well it works, but it looks like you cannot actually click the tabs to navigate. Another option(again, I haven't tried it) that says it preserves clickable tabs is to use the library PagerSlidingTabStrip available on Github. More info on that can be found here on stackoverflow. Let me know if that helps and if you need more assistance.

Well thank you for the fix but I think i found the problem. The loading icon method that Ben added in his Ribbit app doesn´t seem to be supported by Lollipop thus making the app crash just by trying to get it. Could that be right?

Its possible if a method has been removed from the API(which deprecated calls are after a while), that calling that method on a device/emulator could cause it to crash.