Skip to main content

Posts

Showing posts with the label activity example

Example for Activity Life Cycle/Introdution to Activities in Android

Activity Life Cycle/Activity life cycle example in android An activity represents a single screen with a user interface A users can interact in order to do something, such as dial the phone, take a photo, send an email, or view a map An activity is implemented as a subclass of Activity An application usually consists of multiple activities that are loosely bound to each other Example for Activity LifeCycle LifeCycleActivity .java   public class LifeCycleActivity extends Activity {      /** Called when the activity is first created. */     @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Toast.makeText(this, "onCreate()", Toast.L E N  G TH_LO N   G ).show(); } @Override protected void onStart() { //the activity is become visible. super.onStart(); Toast.makeText(this, "onStart()", Toast.L E N  G TH_LO N   G ).show(); } @Override protected void on P ause() { super.onPause();