• Register
Welcome to Kodlogs, programming questions and answer website.
+2 votes


What is the AppCompatActivity?

What is difference between activity and AppCompatActivity in Android?

What is difference between fragment and Fragmentactivity?

Why do we extend AppCompatActivity?

by (1.6k points)  
reshown by

5 Answers

0 votes



Constructor for AppCompatActivity.

<init>(@LayoutRes contentLayoutId: Int)

Alternate constructor  super.onCreate(savedInstanceState).

open class AppCompatActivity : FragmentActivity, AppCompatCallback, TaskStackBuilder.SupportParentable, ActionBarDrawerToggle.DelegateProvider
by (9.7k points)  
0 votes

AppCompatActivity does likewise as an Activity, yet for the majority of the Android renditions. (Movement | Android Developers) 

A piece is not quite the same as an Activity: Fragments | Android Developers

by (9.7k points)  
0 votes

Android AppCompatActivity 

AppCompatActivity is a class that goes about as the super class for exercises that need to exploit the help library activity bar highlights. 

The prerequisite to utilize the android.support.v7.app.ActionBar inside you movement are: 

To run API level 7 or higher. 

At that point broaden this class. 

Set you movement topic to android.support.v7.appcompat.R.style#Theme_AppCompat Theme.AppCompat or comparative subject. 

Topics do get set in the AndroidManifest.xml e.g

by (9.7k points)  
0 votes

AppCompatActivity in Android

The most recent arrival of android bolster library, 22.1, deplores the ActionBarActivity for AppCompatActivity, which guarantees to bring a solitary predictable ActionBar for all gadgets beginning with API Level 7 or more. 
Additionally, the new update adds the capacity to tint gadgets consequently when utilizing AppCompat, and includes support for steady material structure discoursed. Use support.v7.app.AlertDialog (rather than android.app.AlertDialog), to get decent looking material discoursed over various variants of gadgets.
by (9.7k points)  
0 votes

I've imported a project and I have awhole slew of errors beginning with action bar activity cannot be resolvedto type or cannot be resolved tovariable so what I need is this thing called an app compat library for supportv7 and it just so happens I have onehere alreadyI'm going to delete this and we importit so you can watch the process I'm notgoing to delete the source I'm justgoing to delete the project and we'llgive that just one moment ok what I needto do to import the project is I need tofigure out where my Android SDK isinstalled that's easy then windowspreferences select Android and you seehere it's C programs Android Android SDKok I'm going to copy that now I'm goingto choose file and import and I'm goingto say existing Android code intoworkspace I'm going to browse thisdirectory Android SDK I have to dig alittle bit deeper here to find it it'sgoing to be Android SDK extras Androidcompatibility v7 app compat that that'sclose enough to get us where we want togo again our SDK location which we getfrom windows preferences Android thattakes us to this level Android SDK fromthere we go to extras Androidcompatibility app compat and that thatwill take us close enough under v7 Iselect this and you notice that it wantsto import this project called v7 appcompat that's great I choose finishwe'll give this just a moment and nowyou see we have amp Android support v7app compat load it into our workspacenow what I need to do is go to a pictureapplication and I'm going to chooseproperties I'm sorry I realize thatone's off screen I'm going to go toAndroid and what we see here is towardsthe bottom there is a section calledlibrary and what it is is the author ofthis project has specified an app compatv7 library which is great but it islocal tothat person's computer more than likelyso I'm going to choose or it's namedwhatever that person named it maybe notthe same name as mine so I'm going tochoose remove I'm going to choose addand there we go there's my androidsupport v7f compat I'm going to chooseok and now we see it puts the projectwith a name that I've given it in mypath I select ok and we might have onemore now looks like we're we're prettygood there so we'll give this a momentto refresh and we're still having someissues because it says you cannot findthis action bar activity that's becausewe have another support library that'shere in the way this Android support v4so what I'm going to do is I am going toremove this let's see I will go to buildpath configure build path and we'regoing to choose projects librariesAndroid dependencies I'm going to removethis one this app support v7 and we'regoing to choose ok and then I'm going todelete Android support v4 and again giveit a moment to refresh many times thiswill resolve the issue in thisparticular project is being and it'sstubborn and still it's having troubleidentifying this action bar activity soif you've gotten to this point and youstill can't resolve it there's one lastthing that we can do go to build pathand figure build path and from here goto projects choose add and then choosethat app support and add it is adependent project choose ok and give ita moment to refresh and we should be ingood shape this is the worst casetypically when you simply add the appcompat with a library usually that willtake care of the issue this project isjust one that's particularly stubborn soif you're having issues if you continueto have issues after adding that libraryadd it directly to the build path butpercent of the time adding library is aprime as a property the right click as Isaid before right click and thenproperties and then Android peaceful tohere choose Android typically adding agear will result this one just happenedto be a bit stubborn so I hope that'shelpfulwe're also going to have a recording onwhat to do when you see can't findsource .

by (9.7k points)