Android Introduction and LifeCycle
Android Introduction
- Android is Linux based Operating system it is designed for mobiles and tablets.
- Developed by Google later OHA (Open Handset Alliance).
- java and kotlin are programming languages.
- Google announced 2 billion monthly active devices
Android Features
- It is open-source.
- Anyone can customize the Android Platform.
- There are a lot of mobile applications that can be chosen by the consumer.
- It provides many interesting features like weather details, opening screen
Android App Lifecycle
Android App has following 5 States:
1) Starting State:
When an activity does not yet exist in memory, it is in the starting state.
2) Resumed/Running State:
An activity that is in the foreground is in the running state. Any activity that is currently on the screen and interacting with the user is the running activity at that particular point in time. It exists at the top of the activity stack.
3) Paused State:
When an activity is not in focus (i.e. not interacting with the user), but is still visible on the screen, it is in the paused state.
4) Stopped State:
An activity that is not visible on the screen, but exists in the memory is in the stopped state.
5) Destroyed State:
A destroyed activity results from the removal of an activity (that is no longer required) from the memory. Such removals generally occur, when the activity manager decides that there is no use for such activities anymore.
public class MainActivity extends AppCompatActivity {
@Override protected void onStart() {
super.onStart();
Toast.makeText(this, "ONSTART", Toast.LENGTH_SHORT).show();
}
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toast.makeText(this, "ONCREATE", Toast.LENGTH_SHORT).show();
}
@Override protected void onResume() {
super.onResume();
Toast.makeText(this, "ONRESUME", Toast.LENGTH_SHORT).show();
}
@Override protected void onPause() {
super.onPause();
Toast.makeText(this, "ONPAUSE", Toast.LENGTH_SHORT).show();
}
@Override protected void onStop() {
super.onStop();
Toast.makeText(this, "ONSTOP", Toast.LENGTH_SHORT).show();
}
@Override protected void onDestroy() {
super.onDestroy();
Toast.makeText(this, "ONDESTROY", Toast.LENGTH_SHORT).show();
}
No comments