4

I was struggling with using AppCompatActivity and Activity (and recently realized there is ActivityCompat even) and things like Toolbar vs ActionBar etc. it feels like things using AppCompat seem to be more stable. For example it works so much more smoothly with things like PreferenceFragment.

On the other hand, as I understand the AppCompat is mostly for supporting devices below APIv21 which not even supported by security patches today.

So, is there any reason to use AppCompat in a new application? What is the future of AppCompat? Is it a sliding window of versions or AppCompat will be phased off in future?

Thanks!

Evren Yurtesen
  • 2,267
  • 1
  • 22
  • 40
  • 2
    WHile this is probably more opinion based question `AppCompat` will get regular bug fixes if it needs it and provides backwards compatability vs a normal `Activity` which really wont get any bug fixes until a new android version and if you need something specific for a newer android version you have no way to packport the usage for older devices. I would say is there a reason to NOT use it? – tyczj Dec 08 '17 at 19:09
  • 1
    @tyczj: "I would say is there a reason to NOT use it?" -- 1MB of resources and ~12K method references is one reason. `AppCompatActivity` adds little to no value on its own; it is mostly there to wire in the rest of the scaffolding for the `Theme.AppCompat` support on pre-5.0 devices. `appcompat-v7` fixes ~0 bugs in the framework classes, as it does not replace the framework classes (the way, say, `support-fragment` replaces `Fragment`). – CommonsWare Dec 08 '17 at 19:17
  • So what you are saying is that `AppCompat` support a sliding window of old versions. After 2 years we won't need to change it to something else? Meanwhile, for example 'Activity' will drop support of Android5 devices in future? – Evren Yurtesen Dec 08 '17 at 19:26
  • 1
    "Meanwhile, for example 'Activity' will drop support of Android5 devices in future?" -- no. `Activity` has been there since API Level 1. It will remain there for the foreseeable future, for backwards compatibility. – CommonsWare Dec 08 '17 at 19:29

0 Answers0