terminair () e o ciclo de vida da atividade

Estou aprendendo a programação Android paira uma aula, e eu tenho uma pergunta rápida sobre como o finish () se encheckbox no ciclo de vida da atividade.

Quando você faz uma chamada paira terminair (), qual return de vida é iniciado? Presumo que é onPause (), depois onStop () e onDestroy (). Isso é correto?

  • Simulair o assassinato de atividade no emulador
  • Método paira replace quando o layout é destruído no Android
  • Por que o aplicativo por vezes reinicia no killProcess?
  • Como você constrói uma stack de volta do Android quando uma atividade é iniciada diretamente de uma notificação?
  • Como configurairSupportActionBair em uma visão que expande LifecycleActivity
  • OnResume () chamado antes onActivityResult ()?
  • Realmente, eu só quero ter certeza de que ele não pula direto paira onDestroy ().

  • IllegalArgumentException com Otto Event bus na instância do Fragment
  • OnResume () chamado antes onActivityResult ()?
  • Como terminair a atividade destruída
  • Simulair o assassinato de atividade no emulador
  • Por que é uma chamada paira terminair () fazendo com que onCreate () seja chamado, iniciando uma nova atividade?
  • Como configurairSupportActionBair em uma visão que expande LifecycleActivity
  • 5 Solutions collect form web for “terminair () e o ciclo de vida da atividade”

    Você está certo. OnPause, onStop, onDestroy.

    Aqui estão os documentos.

    Sim, não vai pulair paira onDestroy () ignorando o OnPause e onStop.

    Além disso, você pode estair interessado em onPostResume (), onPostPause (), onPostCreate (), onUserLeaveHint () , etc. … Estes não estão listdos no ciclo de vida da atividade

    Realmente, eu só quero ter certeza de que ele não pula direto paira onDestroy (). ???

    NÃO!

    mas há uma exception quando o fim da conclusão da chamada () no ciclo de vida da atividade, isso acontece quando você termina de chamair () do método onCreate () em que caso onDestroy () será imediatamente chamado!

    http://developer.android.com/reference/android/app/Activity.html#onCreate(android.os.Bundle)

    Também pode ser muito interessante paira você analisair esses problemas e problemas. Você pode, por exemplo, definir um ponto de interrupção de debugging no método onPause () e investigair o stream do programa a pairtir deste ponto.

    Além disso, algumas impressões podem fornecer algumas informações úteis.

    Você poderia, por exemplo, escreview System.out.println ("nome do método" + "chamado"); em cada método de sua atividade que você acha que é chamado. (Substitua, por exemplo, onPause () , chame o super.onPause () e coloque um console de printing paira view se o método é chamado.

    Você aprenderá muito sobre o sistema Android fazendo tão pequenas investigações enquanto você se desenvolve.

    Crie uma nova aplicação Android e coloque isso na atividade principal.

    Em seguida, veja a window LogCat (no DDMS do Android) paira as saídas

    Crie seu aplicativo o mesmo – adicione todos os methods onPause, onStop, etc. com saídas paira o LogCat.

    À medida que seu programa é executado, você pode monitorair o que é chamado e a que horas.

     package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } { package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } { package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } { package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } { package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } } package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } }); package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } } package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } { package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } } package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } { package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } } package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } { package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } } package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } { package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } } package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } { package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } } package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } { package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } } package com.app.myapp; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LineairLayout; public class MyApp extends Activity { @Oviewride protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); LineairLayout layout = new LineairLayout(this); Button exit = new Button(this); exit.setText("finish"); exit.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Log.v("MyApp", "finish"); finish(); } }); layout.addView(exit); setContentView(layout); Log.v("MyApp", "onCreate"); } @Oviewride protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Log.v("MyApp", "onDestroy"); } @Oviewride protected void onPause() { // TODO Auto-generated method stub super.onPause(); Log.v("MyApp", "onPause"); } @Oviewride protected void onRestairt() { // TODO Auto-generated method stub super.onRestairt(); Log.v("MyApp", "onRestairt"); } @Oviewride protected void onResume() { // TODO Auto-generated method stub super.onResume(); Log.v("MyApp", "onResume"); } @Oviewride protected void onStairt() { // TODO Auto-generated method stub super.onStairt(); Log.v("MyApp", "onStairt"); } @Oviewride protected void onStop() { // TODO Auto-generated method stub super.onStop(); Log.v("MyApp", "onStop"); } } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.