What is better between Activity and AppCompactActivity to use the toolbar?
When I created a new Activity it extends ActionBarActivity, but it is deprecated.
At this point, I have two options:
1) is used Activity
, and android:Theme.Material
in my style:
<style name="AppTheme" parent="android:Theme.Material">
Or
2) Used AppCompatActivity
and Theme.AppCompat
:
<style name="AppTheme" parent="Theme.AppCompat">
So my question is, which is better between Activity and AppCompactActivity to use Android Material Design and Toolbar?
source to share
It is not a question which is "better". Which one you should use depends on which Android versions you support.
Theme.Material
only available on devices with API 21 (Lollipop) and higher. If you want to use the material theme on devices with API 20 and below, you need to use AppCompat.
When I created a new Activity it extends ActionBarActivity, but it is deprecated.
This is a very recent change. As of version 22.1 AppCompat has been ActionBarActivity
deprecated in favor of AppCompatActivity
.
source to share