What is the difference between Extends Application and Extends Activity in Android?

前端 未结 5 1026
花落未央
花落未央 2020-12-29 03:38

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 E

5条回答
  •  粉色の甜心
    2020-12-29 04:17

    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'.

提交回复
热议问题