What's the difference between AppCompatActivity and Activity?

9
  • What's the difference between AppCompatActivity and Activity ?
  • From which version did AppCompatActivity be added to Android ?
asked by anonymous 18.03.2016 / 11:04

1 answer

10

The difference is that AppCompactActivity you can, using support library , use ActionBar (introduced at API level 11 ) in applications from API level 7 .

After revision 22.1, support library also includes support for color palette , widget tinting and Toolbar tags.

As of revision 24.2 the class ActionBarActivity , which hitherto served for this purpose, was considered obsolete.

So, in order for applications using the above facilities to run at API level 7 or higher, you will need to do your Activities inherit from href="http://developer.android.com/intl/en/reference/android/support/v7/app/AppCompatActivity.html">AppCompactActivity .

In relation to which version the class was added I think it exists since the support library (v4) was introduced in March 2011. However, it was with its update in revision 22.1 (April 2015) that it became the base class for Activities use ActionBar in "compatibility mode ".

    
18.03.2016 / 15:46