5

When creating an app in Android Studio and selecting the Activity name I have a button that says "Backwards compatibility (AppCompat)". And below it says "If false, this activity base class will be Activity instead of AppCompatActivity".

What is this backwards compatibility about?

halfer
  • 19,824
  • 17
  • 99
  • 186
fernando1979
  • 1,727
  • 2
  • 20
  • 26
  • No sorry, about the difference between using a AppCompatActivity vs Activity and the backwards compatibility issue – fernando1979 Oct 19 '16 at 21:31
  • 1
    http://stackoverflow.com/a/31297546/115145 – CommonsWare Oct 19 '16 at 21:35
  • 1
    Also http://stackoverflow.com/a/38963902/115145 – CommonsWare Oct 19 '16 at 21:38
  • As far as I understood reading your links, AppCompatActivity was added in api level 7 and it was created to support action bars. It inherits from Activity but native action bars were added in api level 11. I undertand If you want to use old fashion action bars (added in api level 7) you can use AppCompatActivity., other way you can use native ones from api level 11. – fernando1979 Oct 19 '16 at 22:07
  • 1
    Everything in your last comment is completely wrong. Quoting my first linked answer: "`AppCompatActivity` is from the `appcompat-v7` library. Principally, this offers a backport of the action bar. Since the native action bar was added in API Level 11, you do not need `AppCompatActivity` for that. However, current versions of `appcompat-v7` also add a limited backport of the Material Design aesthetic, in terms of the action bar and various widgets. There are pros and cons of using appcompat-v7, well beyond the scope of this specific Stack Overflow answer." – CommonsWare Oct 19 '16 at 22:12
  • Sorry, I did not read well. So appcompat-v7 is a third party library? – fernando1979 Oct 19 '16 at 22:38
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/126167/discussion-between-user3254515-and-commonsware). – fernando1979 Oct 19 '16 at 22:41
  • `appcompat-v7` is part of [the Android Support suite of libraries](https://developer.android.com/topic/libraries/support-library/index.html). – CommonsWare Oct 19 '16 at 22:46
  • Ok. But if I have selected api level 15 as minimunSdk and "the native action bar was added in API Level 11," why Android Studio offers me to use AppCompatActivity(a class from appcompat-v7 library) if I can use native api to create action bars? I dont know if I am missing something – fernando1979 Oct 20 '16 at 13:57
  • 1
    "However, current versions of appcompat-v7 also add a limited backport of the Material Design aesthetic, in terms of the action bar and various widgets". IOW, on Android 4.x devices in particular, your action bar and widgets will look like Android 5.x+ defaults (`Theme.Material`) rather than what normally appears on Android 4.x (`Theme.Holo`). – CommonsWare Oct 20 '16 at 13:59

1 Answers1

-1

So preview version of Android API level extends just Activity for all level, I remember from froyo and Gingerbread very well, so in these version of API level No Action bar was associated with it, or more or less ActionBar were optional and were mostly implemented with third party libraries. from jellybean, 4.2.X above ActionBar was becoming standard in Android. At this point in time Activity now extends ActionBarActivity instead of the usual 'Activity' and after a while it become 'AppCompat'. So basically the ActionBar support was one of the major difference, as previous API level will not be able to process 'AppCompat', obviously there are some other differnce , but ActionBar is part of the major Differnce. while all API level can still handle the plain usual Activity

Ibukun Muyide
  • 1,294
  • 1
  • 15
  • 23