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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Alex Hexan](https://secure.gravatar.com/avatar/0490d887ff1a963345d2d0a3cfd1cb0c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Alex Hexan
Courses Plus Student 769 PointsAnything 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:
'''java
final ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);
mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
actionBar.setSelectedNavigationItem(position);
}
});
for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
actionBar.addTab(
actionBar.newTab()
.setText(mSectionsPagerAdapter.getPageTitle(i))
.setTabListener(this));
}'''
Ive got this line in the beggining of the Activity:
'''java
public class MainActivity extends ActionBarActivity implements ActionBar.TabListener { '''
ActionBarActivity, .TabListener
2 Answers
![Alex Hexan](https://secure.gravatar.com/avatar/0490d887ff1a963345d2d0a3cfd1cb0c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Alex Hexan
Courses Plus Student 769 PointsSorry if this is extremely messy. Getting to know this site.
![James Simshaw](https://secure.gravatar.com/avatar/f01e346c98a43044a15179643be83cb3?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
James Simshaw
28,738 PointsHello,
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.
![Alex Hexan](https://secure.gravatar.com/avatar/0490d887ff1a963345d2d0a3cfd1cb0c?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Alex Hexan
Courses Plus Student 769 PointsWell 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?
![James Simshaw](https://secure.gravatar.com/avatar/f01e346c98a43044a15179643be83cb3?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
James Simshaw
28,738 PointsIts 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.
James Simshaw
28,738 PointsJames Simshaw
28,738 PointsHello,
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?