What is activity?
Ans: The user interface of an application is displayed on a device through an Activity, Mostly with one Activity created for each unique screen.
An activity can be created by extending "Activity" class from "android.app.*" package.
Activity class take care of creating a window for your application.
onStart()
onResume()
onPause()
onStop()
onDestroy()
Note: Flow order of above methods will depend on activity state.
How to kill/destroy activity ?
Ans: By calling activities finish() method.
When onDestroy() will be called in Acivity?
Ans: Typically for 2 reasons
1.call to finish() from application
2.Android run time decides to kill your activity.
Is it required to declare every activity in Android manifest file?
Ans: Yes. If not declared then that activity will not visible to Android system and it will never run.
What is ListActivity in android?
Ans:This is an activity that displays the list of items by binding to the data source. This activity provides handy methods to manage list of items.
What is difference between Activity and ListActivity?
Ans:ListActivity provides the easy to use methods to manage list of items.(ListView)
What are the important methods in Activity class?
Ans: onCreate()onStart()
onResume()
onPause()
onStop()
onDestroy()
Note: Flow order of above methods will depend on activity state.
If activity 'A' fully obscured by activity 'B' then which methods will be called in activity 'A'?
Ans: onPause() --> onStop()If activity 'A' partially covered by another screen then which methods will be called in activity 'A'?
Ans: onPause()If we display dialog box from current activity then what would be the state of current acivity?
Ans: Activities state will remain same , because Alert dialog box will be considered as a child view.When activity is in foreground and user presses 'Home' button then which methods will be called?
Ans: onPause() --> onStop(). Home screen is also an activity.What is the life cycle of Activity in android?
Ans: Below diagram depicts the life cycle of android.How to kill/destroy activity ?
Ans: By calling activities finish() method.
When onDestroy() will be called in Acivity?
Ans: Typically for 2 reasons
1.call to finish() from application
2.Android run time decides to kill your activity.
Is it required to declare every activity in Android manifest file?
Ans: Yes. If not declared then that activity will not visible to Android system and it will never run.
What is ListActivity in android?
Ans:This is an activity that displays the list of items by binding to the data source. This activity provides handy methods to manage list of items.
What is difference between Activity and ListActivity?
Ans:ListActivity provides the easy to use methods to manage list of items.(ListView)
No comments:
Post a Comment