tags:

views:

284

answers:

1

I am confused as to the difference between the two. In my application I have just used Extends Activity and the application is working perfectly, so what is the purpose of Extends Application?.

Would you use it on the first class you create in the Android application?

Thanks.

+1  A: 

The android.app.Application class is an optional facility for extending and storing application-global state. There are other ways of doing this, so most apps don't customize this class.

Activities however are what defines every major stage of your application. It wouldn't be possible to build an application without Activities. You will have a main Activity class and this will indeed be defined with 'extends Activity'.

Jim Blackler
I don't mean to be pedantic but did you mean "It wouldn't be possible to build an application without Activities"?. I just want to be completely clear on this.
LordSnoutimus
Well Activites are the building block of apps. Like pages to a web application. Any app will have at least one (although you might be able to have a Widget without one I suppose). Your app will need an entry point Activity.
Jim Blackler
So can you start classes that extend application, similar to starting Activities using intent?
LordSnoutimus
You can't start an Application class no.
Jim Blackler