Categories

วันศุกร์ที่ 10 กรกฎาคม พ.ศ. 2552

State Change

import android.app.Activity;
import android.os.Bundle;
public class MyActivity extends Activity {
    // Called at the start of the full lifetime.
    @Override
    public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
         // Initialize activity.
    }
    // Called after onCreate has finished, use to restore UI state
    @Override
    public void onRestoreInstanceState(Bundle savedInstanceState) {
         super.onRestoreInstanceState(savedInstanceState);
         // Restore UI state from the savedInstanceState.
         // This bundle has also been passed to onCreate.
    }
    // Called before subsequent visible lifetimes
    // for an activity process.
    @Override
    public void onRestart(){
         super.onRestart();
         // Load changes knowing that the activity has already
         // been visible within this process.
    }
    // Called at the start of the visible lifetime.
    @Override
    public void onStart(){
         super.onStart();
         // Apply any required UI change now that the Activity is visible.
    }
    // Called at the start of the active lifetime.
    @Override
    public void onResume(){
         super.onResume();
         // Resume any paused UI updates, threads, or processes required
         // by the activity but suspended when it was inactive.
    }
    // Called to save UI state changes at the
    // end of the active lifecycle.
         @Override
         public void onSaveInstanceState(Bundle savedInstanceState) {
         // Save UI state changes to the savedInstanceState.
         // This bundle will be passed to onCreate if the process is
         // killed and restarted.
         super.onSaveInstanceState(savedInstanceState);
    }
    // Called at the end of the active lifetime.
    @Override
    public void onPause(){
         // Suspend UI updates, threads, or CPU intensive processes
         // that don’t need to be updated when the Activity isn’t
         // the active foreground activity.
         super.onPause();
    }
    // Called at the end of the visible lifetime.
    @Override
    public void onStop(){
         // Suspend remaining UI updates, threads, or processing
         // that aren’t required when the Activity isn’t visible.
         // Persist all edits or state changes
         // as after this call the process is likely to be killed.
         super.onStop();
    }
    // Called at the end of the full lifetime.
    @Override
    public void onDestroy(){
         // Clean up any resources including ending threads,
         // closing database connections etc.
         super.onDestroy();
    }
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น

Search

เกิดข้อผิดพลาดใน Gadget นี้