Questions tagged [appcompatactivity]

Base class for activities that use the support library action bar features.

Base class for activities that use the support library action bar features.

You can add an ActionBar to your activity when running on API level 7 or higher by extending this class for your activity and setting the activity theme to Theme.AppCompat or a similar theme.

AppCompatActivity was added Support v7 r22. Please see the changes here.

Official documentation here.

308 questions
319
votes
7 answers

Activity, AppCompatActivity, FragmentActivity, and ActionBarActivity: When to Use Which?

I'm coming from iOS where it's easy and you simply use a UIViewController. However, in Android things seem much more complicated, with certain UIComponents for specific API Levels. I'm reading BigNerdRanch for Android (the book is roughly 2 years…
164
votes
6 answers

What's the enhancement of AppCompatActivity over ActionBarActivity?

android.support.v7.app.AppCompatActivity was added into the latest v7 support library as a new feature yesterday. It is said that ActionBarActivity has been deprecated in favor of the new AppCompatActivity and that AppCompatActivity is base class…
57
votes
8 answers

How to fix: "You need to use a Theme.AppCompat theme (or descendant) with this activity"

I am having trouble running my Android app in a fullscreen mode per instructions of a video. When it tries to run, the app crashes with the error. "You need to use a Theme.AppCompat theme (or descendant) with this activity Manifest File
Doug Steiert
  • 625
  • 2
  • 6
  • 12
45
votes
35 answers

can't resolve AppCompatActivity

After renaming application package name, Android Studio displayed this error can't resolve symbol AppCompatActivity Things I tried: Clean project Clean Android Studio cache Clean Gradle cache Re-installed IDE File-> Invalidate cache/restart…
45
votes
9 answers

How to display menu item with icon and text in AppCompatActivity

I tried different combinations in xml file:
Yarh
  • 4,459
  • 5
  • 45
  • 95
44
votes
23 answers

Error : Ambiguous method call. Both findViewById (int) in AppCompactActivity and Activity

I am getting the error: "Ambiguous method call" on initializing Toolbar using Android Studio 3.0 RC1. I have extended my Activity with AppCompatActivity and compiling my application using 'compileSdkVersion 26'. Attaching a screenshot of the error.
38
votes
9 answers

How to remove Title Bar from Activity extending ActionBarActivity or AppcompatActivity with Dialog Theme

I had to extend my Activity with theme Theme.AppCompat.Light.Dialog from ActionBarActivity before and now from AppcompatActivity, because my Base Activity extends this one. But now with new appcompat v7 (v22) library my Activity started to show…
22
votes
1 answer

AppCompatActivity instead of ComponentActivity in Jetpack compose

I want to open datePicker dialog on a button click in Jetpack compose. For that, I am using the below code inside the button's onClick action. val context = LocalContext.current Button(onClick = { (context as AppCompatActivity).let { val…
Bharat Kumar
  • 806
  • 14
  • 22
21
votes
5 answers

Do not request Window.FEATURE_ACTION_BAR issue

I'm trying to build my app but without success.. I tried several way but nothing was worked. The exception is: Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request…
Atlas91
  • 5,754
  • 17
  • 69
  • 141
20
votes
5 answers

Android Back Arrow on Toolbar (AppCompatActivity)

I want to show the back arrow button in my app, but the app crashes when I put this in my code: getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); style.xml