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
Matthew Chapman
2,957 PointsWhat does it mean that android.support.v7.app.ActionBarActivity is deprecated? And how do I fix this problem?
In my java code for my new project, there is a line going through ActionBarActivity. When I hover over it is get a message that android.support.v7.app.ActionBarActivity is deprecated. I believe its preventing my java files from Autocompleting some of my commands.
1 Answer
James Simshaw
28,738 PointsHello,
When something is deprecated, it means the developers are getting ready to remove it from the language/API that you are using. Typically they have something different to replace it with, other times they may not. In this case, if you look on the Android docs for ActionBarActivity here, you can see that they recommend using a new class called AppCompatActivity. It's documentation is located here. At first glance, it looks like it supports most, if not all, of the methods ActionBarActivity supported. You will have to check the documentation to make sure that is the case for the methods you are looking to use. Hopefully this helps answer your question, if not, please let us know and we can try to provide further assistance.
Billy Lardizabal
5,017 PointsBilly Lardizabal
5,017 Pointsso how do we fix our code? just replace ActionBarActivity with AppCompatActivity?
James Simshaw
28,738 PointsJames Simshaw
28,738 PointsIf the same function is supported in AppCompatActivity(which you will have to check the documentation for to make sure), then in all likelihood, yes, you would be able to just drop it in the place of ActionBarActivity. Sometimes some parameters do change, so you will have to keep an eye out for that.