lopez.mikhael
lopez.mikhael

Reputation: 10071

What is better between Activity and AppCompactActivity to use Toolbar?

When I created a new activity, it extends ActionBarActivity but it's deprecated.

At that moment, I have two options:

1) Used Activity and android:Theme.Material in my style like that :

<style name="AppTheme" parent="android:Theme.Material">

Or

2) Used AppCompatActivity and Theme.AppCompat :

<style name="AppTheme" parent="Theme.AppCompat">

So my question is, what is better between Activity and AppCompactActivity to use Android Material Design and Toolbar ?

Upvotes: 4

Views: 4131

Answers (1)

Bryan Herbst
Bryan Herbst

Reputation: 67239

It isn't a matter of which is "better". Which one you should use depends on what versions of Android you are supporting.

Theme.Material is only available on devices running API 21 (Lollipop) and up. If you wish to use the Material theme on devices running API 20 and below, you need to use AppCompat.

When I created a new activity, it extends ActionBarActivity but it's deprecated.

This is a very recent change. As of version 22.1 of AppCompat, ActionBarActivity has been deprecated in favor of AppCompatActivity.

Upvotes: 9

Related Questions