Each Android application has one or more Activities.
Each Activity has a lifecycle.
Each screen we want to use as an interactive component is an Activity.
So this application component must extends the Activity class.
Interactive component is a component that the user uses to do something, for example, send an email, take a photo, etc.
1. Lifecycle of an Activity There is below their fundamental methods:
public class ExampleActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // The activity is being created. } @Override protected void onStart() { super.onStart(); // The activity is about to become visible. } @Override protected void onResume() { super.onResume(); // The activity has become visible (it is now "resumed"). } @Override protected void onPause() { super.onPause(); // Another activity is taking focus (this activity is about to be "paused"). } @Override protected void onStop() { super.onStop(); // The activity is no longer visible (it is now "stopped") } @Override protected void onDestroy() { super.onDestroy(); // The activity is about to be destroyed. } } So an activity may be used in interaction with several activities.
When an activity starts another one, the first is always in the stack (the back stack).
The second one may send data to the first with, for example, a return value and after the end of the second one, the first activity receives this data to use it.
...