What is an Activity? Which method is implemented by all subclasses of an Activity?

Answer

An Activity is the screen representation of an application in Android.

It serves as an entry point for the user’s interaction. Each activity has a layout file where you can place your UI. An application can have different activities. For example, facebook start page where you enter your email/phone and password to login acts as an activity.

Below are the two methods which almost all subclasses of Activity will implement:

  • onCreate(Bundle): It is a method where your initialization is done. Under this, you will callsetContentView(int) with a layout resource which defines your UI.  Also, you can retrieve the widgets in that UI by using findViewById(Int).  These are required to interact programmatically.
  • onPause(): It is a method which deals with the user whenever it leaves the activity. So any changes made by the user should be commited which is done by the ContentProvider that holds the data. 

All android-5.0-lollipop Questions

Ask your interview questions on android-5-0-lollipop

Write Your comment or Questions if you want the answers on android-5-0-lollipop from android-5-0-lollipop Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---