Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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 ?

share|improve this question
2  
Use AppCompatActivity if you want to support pre v21 devices; –  Eenvincible May 11 at 15:56

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
2  
ActionBarActivity wasn't renamed. It was deprecated to favor AppCompatActivity. –  joaquin May 11 at 16:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.