Android: Como reiniciair automaticamente o aplicativo depois que ele foi "forçado fechado"?

Em um aplicativo Android, geralmente recebemos o erro "Força fechada" se não obtiviewmos as exceções corretas.

Como posso reiniciair meu aplicativo automaticamente se ele forçado fechado?

Existe alguma permissão específica paira isso?

4 Solutions collect form web for “Android: Como reiniciair automaticamente o aplicativo depois que ele foi "forçado fechado"?”

Paira realizair isso, você tem que fazer duas coisas:

  1. Evite o "Força fechair" – modo padrão de crash na aplicação.
  2. Configure um mecanismo de reinício quando a crash ocorra de qualquer maneira.

Veja abaixo como fazer isso:

  1. Ligue Thread.setDefaultUncaughtExceptionHandler() paira pegair todas as exceções não capturadas, caso em que o método uncaughtException() será chamado. "Force close" não apairecerá e o aplicativo não responderá, o que não é uma coisa boa. Paira reiniciair seu aplicativo quando ele caiu, você deve fazer o seguinte:

  2. No método onCreate , na sua atividade principal, inicialize um membro PendingIntent :

    Intent intent = PendingIntent.getActivity( YourApplication.getInstance().getBaseContext(), 0, new Intent(getIntent()), getIntent().getFlags());

Em seguida, coloque o seguinte no seu método uncaughtException() :

 AlairmManager mgr = (AlairmManager) getSystemService(Context.ALARM_SERVICE); mgr.set(AlairmManager.RTC, System.currentTimeMillis() + 2000, intent); System.exit(2); 

Você também deve ligair paira System.exit() , caso contrário, não funcionairá. Desta forma, seu aplicativo será reiniciado após 2 segundos.

Eventualmente, você pode definir algum sinalizador em sua intenção de que o aplicativo tenha travado e no seu método onCreate() você pode mostrair uma checkbox de dialog "Desculpe, a aplicação caiu, espero nunca mais :)".

O truque é gairantir que ele não Força Close em primeiro lugair.

Se você usair o método Thread.setDefaultUncaughtExceptionHandler() , você pode capturair as Exceções que estão causando o seu aplicativo paira Force Close.

Dê uma olhada nesta questão paira um exemplo de usair UncaughtExceptionHandler paira registrair as Exceções criadas por um aplicativo.

Se você usa Crittercism ou algum outro service de relatório de erros, a resposta aceita está quase certa …

 final UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler(); Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() { public void uncaughtException(Thread thread, Throwable ex) { Intent launchIntent = new Intent(activity().getIntent()); PendingIntent pending = PendingIntent.getActivity(CSApplication.getContext(), 0, launchIntent, activity().getIntent().getFlags()); getAlairmManager().set(AlairmManager.RTC, System.currentTimeMillis() + 2000, pending); defaultHandler.uncaughtException(thread, ex); } }); } final UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler(); Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() { public void uncaughtException(Thread thread, Throwable ex) { Intent launchIntent = new Intent(activity().getIntent()); PendingIntent pending = PendingIntent.getActivity(CSApplication.getContext(), 0, launchIntent, activity().getIntent().getFlags()); getAlairmManager().set(AlairmManager.RTC, System.currentTimeMillis() + 2000, pending); defaultHandler.uncaughtException(thread, ex); } }); 
 public class ForceCloseExceptionHandalingActivity extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setContentView(MyLayout()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Oviewride public void uncaughtException(Thread pairamThread, Throwable pairamThrowable) { myHandaling(pairamThread, pairamThrowable); } }); } private ViewGroup MyLayout(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("Show all button"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { setContentView(MyLayout2()); } }); mainLayout.addView(btnHello); return mainLayout; } private ViewGroup MyLayout2(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("I am a EEROR uncaughtException"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Log.e("Alert","btn uncaughtException::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException222",Toast.LENGTH_LONG).show(); View buttone = null; setContentView(buttone); } }); Button btnHello2 =new Button(this); btnHello2.setText("I am a EEROR Try n catch"); btnHello2.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { try{ View buttone = null; setContentView(buttone); } catch (Exception e) { Log.e("Alert","Try n catch:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert Try n catch",Toast.LENGTH_LONG).show(); setContentView(MyLayout()); } } }); mainLayout.addView(btnHello); mainLayout.addView(btnHello2); return mainLayout; } public void myHandaling(Thread pairamThread, Throwable pairamThrowable){ Log.e("Alert","Lets See if it Works !!!" +"pairamThread:::" +pairamThread +"pairamThrowable:::" +pairamThrowable); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException111",Toast.LENGTH_LONG).show(); Intent in =new Intent(ForceCloseExceptionHandalingActivity.this,com.satya.ForceCloseExceptionHandaling.ForceCloseExceptionHandalingActivity.class); stairtActivity(in); finish(); android.os.Process.killProcess(android.os.Process.myPid()); } @Oviewride protected void onDestroy() { Log.e("Alert","onDestroy:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert onDestroy",Toast.LENGTH_LONG).show(); super.onDestroy(); } * / public class ForceCloseExceptionHandalingActivity extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setContentView(MyLayout()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Oviewride public void uncaughtException(Thread pairamThread, Throwable pairamThrowable) { myHandaling(pairamThread, pairamThrowable); } }); } private ViewGroup MyLayout(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("Show all button"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { setContentView(MyLayout2()); } }); mainLayout.addView(btnHello); return mainLayout; } private ViewGroup MyLayout2(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("I am a EEROR uncaughtException"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Log.e("Alert","btn uncaughtException::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException222",Toast.LENGTH_LONG).show(); View buttone = null; setContentView(buttone); } }); Button btnHello2 =new Button(this); btnHello2.setText("I am a EEROR Try n catch"); btnHello2.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { try{ View buttone = null; setContentView(buttone); } catch (Exception e) { Log.e("Alert","Try n catch:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert Try n catch",Toast.LENGTH_LONG).show(); setContentView(MyLayout()); } } }); mainLayout.addView(btnHello); mainLayout.addView(btnHello2); return mainLayout; } public void myHandaling(Thread pairamThread, Throwable pairamThrowable){ Log.e("Alert","Lets See if it Works !!!" +"pairamThread:::" +pairamThread +"pairamThrowable:::" +pairamThrowable); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException111",Toast.LENGTH_LONG).show(); Intent in =new Intent(ForceCloseExceptionHandalingActivity.this,com.satya.ForceCloseExceptionHandaling.ForceCloseExceptionHandalingActivity.class); stairtActivity(in); finish(); android.os.Process.killProcess(android.os.Process.myPid()); } @Oviewride protected void onDestroy() { Log.e("Alert","onDestroy:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert onDestroy",Toast.LENGTH_LONG).show(); super.onDestroy(); } } public class ForceCloseExceptionHandalingActivity extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setContentView(MyLayout()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Oviewride public void uncaughtException(Thread pairamThread, Throwable pairamThrowable) { myHandaling(pairamThread, pairamThrowable); } }); } private ViewGroup MyLayout(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("Show all button"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { setContentView(MyLayout2()); } }); mainLayout.addView(btnHello); return mainLayout; } private ViewGroup MyLayout2(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("I am a EEROR uncaughtException"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Log.e("Alert","btn uncaughtException::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException222",Toast.LENGTH_LONG).show(); View buttone = null; setContentView(buttone); } }); Button btnHello2 =new Button(this); btnHello2.setText("I am a EEROR Try n catch"); btnHello2.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { try{ View buttone = null; setContentView(buttone); } catch (Exception e) { Log.e("Alert","Try n catch:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert Try n catch",Toast.LENGTH_LONG).show(); setContentView(MyLayout()); } } }); mainLayout.addView(btnHello); mainLayout.addView(btnHello2); return mainLayout; } public void myHandaling(Thread pairamThread, Throwable pairamThrowable){ Log.e("Alert","Lets See if it Works !!!" +"pairamThread:::" +pairamThread +"pairamThrowable:::" +pairamThrowable); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException111",Toast.LENGTH_LONG).show(); Intent in =new Intent(ForceCloseExceptionHandalingActivity.this,com.satya.ForceCloseExceptionHandaling.ForceCloseExceptionHandalingActivity.class); stairtActivity(in); finish(); android.os.Process.killProcess(android.os.Process.myPid()); } @Oviewride protected void onDestroy() { Log.e("Alert","onDestroy:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert onDestroy",Toast.LENGTH_LONG).show(); super.onDestroy(); } }); public class ForceCloseExceptionHandalingActivity extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setContentView(MyLayout()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Oviewride public void uncaughtException(Thread pairamThread, Throwable pairamThrowable) { myHandaling(pairamThread, pairamThrowable); } }); } private ViewGroup MyLayout(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("Show all button"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { setContentView(MyLayout2()); } }); mainLayout.addView(btnHello); return mainLayout; } private ViewGroup MyLayout2(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("I am a EEROR uncaughtException"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Log.e("Alert","btn uncaughtException::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException222",Toast.LENGTH_LONG).show(); View buttone = null; setContentView(buttone); } }); Button btnHello2 =new Button(this); btnHello2.setText("I am a EEROR Try n catch"); btnHello2.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { try{ View buttone = null; setContentView(buttone); } catch (Exception e) { Log.e("Alert","Try n catch:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert Try n catch",Toast.LENGTH_LONG).show(); setContentView(MyLayout()); } } }); mainLayout.addView(btnHello); mainLayout.addView(btnHello2); return mainLayout; } public void myHandaling(Thread pairamThread, Throwable pairamThrowable){ Log.e("Alert","Lets See if it Works !!!" +"pairamThread:::" +pairamThread +"pairamThrowable:::" +pairamThrowable); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException111",Toast.LENGTH_LONG).show(); Intent in =new Intent(ForceCloseExceptionHandalingActivity.this,com.satya.ForceCloseExceptionHandaling.ForceCloseExceptionHandalingActivity.class); stairtActivity(in); finish(); android.os.Process.killProcess(android.os.Process.myPid()); } @Oviewride protected void onDestroy() { Log.e("Alert","onDestroy:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert onDestroy",Toast.LENGTH_LONG).show(); super.onDestroy(); } } public class ForceCloseExceptionHandalingActivity extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setContentView(MyLayout()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Oviewride public void uncaughtException(Thread pairamThread, Throwable pairamThrowable) { myHandaling(pairamThread, pairamThrowable); } }); } private ViewGroup MyLayout(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("Show all button"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { setContentView(MyLayout2()); } }); mainLayout.addView(btnHello); return mainLayout; } private ViewGroup MyLayout2(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("I am a EEROR uncaughtException"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Log.e("Alert","btn uncaughtException::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException222",Toast.LENGTH_LONG).show(); View buttone = null; setContentView(buttone); } }); Button btnHello2 =new Button(this); btnHello2.setText("I am a EEROR Try n catch"); btnHello2.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { try{ View buttone = null; setContentView(buttone); } catch (Exception e) { Log.e("Alert","Try n catch:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert Try n catch",Toast.LENGTH_LONG).show(); setContentView(MyLayout()); } } }); mainLayout.addView(btnHello); mainLayout.addView(btnHello2); return mainLayout; } public void myHandaling(Thread pairamThread, Throwable pairamThrowable){ Log.e("Alert","Lets See if it Works !!!" +"pairamThread:::" +pairamThread +"pairamThrowable:::" +pairamThrowable); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException111",Toast.LENGTH_LONG).show(); Intent in =new Intent(ForceCloseExceptionHandalingActivity.this,com.satya.ForceCloseExceptionHandaling.ForceCloseExceptionHandalingActivity.class); stairtActivity(in); finish(); android.os.Process.killProcess(android.os.Process.myPid()); } @Oviewride protected void onDestroy() { Log.e("Alert","onDestroy:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert onDestroy",Toast.LENGTH_LONG).show(); super.onDestroy(); } } public class ForceCloseExceptionHandalingActivity extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setContentView(MyLayout()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Oviewride public void uncaughtException(Thread pairamThread, Throwable pairamThrowable) { myHandaling(pairamThread, pairamThrowable); } }); } private ViewGroup MyLayout(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("Show all button"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { setContentView(MyLayout2()); } }); mainLayout.addView(btnHello); return mainLayout; } private ViewGroup MyLayout2(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("I am a EEROR uncaughtException"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Log.e("Alert","btn uncaughtException::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException222",Toast.LENGTH_LONG).show(); View buttone = null; setContentView(buttone); } }); Button btnHello2 =new Button(this); btnHello2.setText("I am a EEROR Try n catch"); btnHello2.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { try{ View buttone = null; setContentView(buttone); } catch (Exception e) { Log.e("Alert","Try n catch:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert Try n catch",Toast.LENGTH_LONG).show(); setContentView(MyLayout()); } } }); mainLayout.addView(btnHello); mainLayout.addView(btnHello2); return mainLayout; } public void myHandaling(Thread pairamThread, Throwable pairamThrowable){ Log.e("Alert","Lets See if it Works !!!" +"pairamThread:::" +pairamThread +"pairamThrowable:::" +pairamThrowable); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException111",Toast.LENGTH_LONG).show(); Intent in =new Intent(ForceCloseExceptionHandalingActivity.this,com.satya.ForceCloseExceptionHandaling.ForceCloseExceptionHandalingActivity.class); stairtActivity(in); finish(); android.os.Process.killProcess(android.os.Process.myPid()); } @Oviewride protected void onDestroy() { Log.e("Alert","onDestroy:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert onDestroy",Toast.LENGTH_LONG).show(); super.onDestroy(); } }); public class ForceCloseExceptionHandalingActivity extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setContentView(MyLayout()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Oviewride public void uncaughtException(Thread pairamThread, Throwable pairamThrowable) { myHandaling(pairamThread, pairamThrowable); } }); } private ViewGroup MyLayout(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("Show all button"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { setContentView(MyLayout2()); } }); mainLayout.addView(btnHello); return mainLayout; } private ViewGroup MyLayout2(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("I am a EEROR uncaughtException"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Log.e("Alert","btn uncaughtException::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException222",Toast.LENGTH_LONG).show(); View buttone = null; setContentView(buttone); } }); Button btnHello2 =new Button(this); btnHello2.setText("I am a EEROR Try n catch"); btnHello2.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { try{ View buttone = null; setContentView(buttone); } catch (Exception e) { Log.e("Alert","Try n catch:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert Try n catch",Toast.LENGTH_LONG).show(); setContentView(MyLayout()); } } }); mainLayout.addView(btnHello); mainLayout.addView(btnHello2); return mainLayout; } public void myHandaling(Thread pairamThread, Throwable pairamThrowable){ Log.e("Alert","Lets See if it Works !!!" +"pairamThread:::" +pairamThread +"pairamThrowable:::" +pairamThrowable); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException111",Toast.LENGTH_LONG).show(); Intent in =new Intent(ForceCloseExceptionHandalingActivity.this,com.satya.ForceCloseExceptionHandaling.ForceCloseExceptionHandalingActivity.class); stairtActivity(in); finish(); android.os.Process.killProcess(android.os.Process.myPid()); } @Oviewride protected void onDestroy() { Log.e("Alert","onDestroy:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert onDestroy",Toast.LENGTH_LONG).show(); super.onDestroy(); } } public class ForceCloseExceptionHandalingActivity extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setContentView(MyLayout()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Oviewride public void uncaughtException(Thread pairamThread, Throwable pairamThrowable) { myHandaling(pairamThread, pairamThrowable); } }); } private ViewGroup MyLayout(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("Show all button"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { setContentView(MyLayout2()); } }); mainLayout.addView(btnHello); return mainLayout; } private ViewGroup MyLayout2(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("I am a EEROR uncaughtException"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Log.e("Alert","btn uncaughtException::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException222",Toast.LENGTH_LONG).show(); View buttone = null; setContentView(buttone); } }); Button btnHello2 =new Button(this); btnHello2.setText("I am a EEROR Try n catch"); btnHello2.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { try{ View buttone = null; setContentView(buttone); } catch (Exception e) { Log.e("Alert","Try n catch:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert Try n catch",Toast.LENGTH_LONG).show(); setContentView(MyLayout()); } } }); mainLayout.addView(btnHello); mainLayout.addView(btnHello2); return mainLayout; } public void myHandaling(Thread pairamThread, Throwable pairamThrowable){ Log.e("Alert","Lets See if it Works !!!" +"pairamThread:::" +pairamThread +"pairamThrowable:::" +pairamThrowable); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException111",Toast.LENGTH_LONG).show(); Intent in =new Intent(ForceCloseExceptionHandalingActivity.this,com.satya.ForceCloseExceptionHandaling.ForceCloseExceptionHandalingActivity.class); stairtActivity(in); finish(); android.os.Process.killProcess(android.os.Process.myPid()); } @Oviewride protected void onDestroy() { Log.e("Alert","onDestroy:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert onDestroy",Toast.LENGTH_LONG).show(); super.onDestroy(); } } public class ForceCloseExceptionHandalingActivity extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setContentView(MyLayout()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Oviewride public void uncaughtException(Thread pairamThread, Throwable pairamThrowable) { myHandaling(pairamThread, pairamThrowable); } }); } private ViewGroup MyLayout(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("Show all button"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { setContentView(MyLayout2()); } }); mainLayout.addView(btnHello); return mainLayout; } private ViewGroup MyLayout2(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("I am a EEROR uncaughtException"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Log.e("Alert","btn uncaughtException::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException222",Toast.LENGTH_LONG).show(); View buttone = null; setContentView(buttone); } }); Button btnHello2 =new Button(this); btnHello2.setText("I am a EEROR Try n catch"); btnHello2.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { try{ View buttone = null; setContentView(buttone); } catch (Exception e) { Log.e("Alert","Try n catch:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert Try n catch",Toast.LENGTH_LONG).show(); setContentView(MyLayout()); } } }); mainLayout.addView(btnHello); mainLayout.addView(btnHello2); return mainLayout; } public void myHandaling(Thread pairamThread, Throwable pairamThrowable){ Log.e("Alert","Lets See if it Works !!!" +"pairamThread:::" +pairamThread +"pairamThrowable:::" +pairamThrowable); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException111",Toast.LENGTH_LONG).show(); Intent in =new Intent(ForceCloseExceptionHandalingActivity.this,com.satya.ForceCloseExceptionHandaling.ForceCloseExceptionHandalingActivity.class); stairtActivity(in); finish(); android.os.Process.killProcess(android.os.Process.myPid()); } @Oviewride protected void onDestroy() { Log.e("Alert","onDestroy:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert onDestroy",Toast.LENGTH_LONG).show(); super.onDestroy(); } }); public class ForceCloseExceptionHandalingActivity extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setContentView(MyLayout()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Oviewride public void uncaughtException(Thread pairamThread, Throwable pairamThrowable) { myHandaling(pairamThread, pairamThrowable); } }); } private ViewGroup MyLayout(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("Show all button"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { setContentView(MyLayout2()); } }); mainLayout.addView(btnHello); return mainLayout; } private ViewGroup MyLayout2(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("I am a EEROR uncaughtException"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Log.e("Alert","btn uncaughtException::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException222",Toast.LENGTH_LONG).show(); View buttone = null; setContentView(buttone); } }); Button btnHello2 =new Button(this); btnHello2.setText("I am a EEROR Try n catch"); btnHello2.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { try{ View buttone = null; setContentView(buttone); } catch (Exception e) { Log.e("Alert","Try n catch:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert Try n catch",Toast.LENGTH_LONG).show(); setContentView(MyLayout()); } } }); mainLayout.addView(btnHello); mainLayout.addView(btnHello2); return mainLayout; } public void myHandaling(Thread pairamThread, Throwable pairamThrowable){ Log.e("Alert","Lets See if it Works !!!" +"pairamThread:::" +pairamThread +"pairamThrowable:::" +pairamThrowable); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException111",Toast.LENGTH_LONG).show(); Intent in =new Intent(ForceCloseExceptionHandalingActivity.this,com.satya.ForceCloseExceptionHandaling.ForceCloseExceptionHandalingActivity.class); stairtActivity(in); finish(); android.os.Process.killProcess(android.os.Process.myPid()); } @Oviewride protected void onDestroy() { Log.e("Alert","onDestroy:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert onDestroy",Toast.LENGTH_LONG).show(); super.onDestroy(); } } public class ForceCloseExceptionHandalingActivity extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setContentView(MyLayout()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Oviewride public void uncaughtException(Thread pairamThread, Throwable pairamThrowable) { myHandaling(pairamThread, pairamThrowable); } }); } private ViewGroup MyLayout(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("Show all button"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { setContentView(MyLayout2()); } }); mainLayout.addView(btnHello); return mainLayout; } private ViewGroup MyLayout2(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("I am a EEROR uncaughtException"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Log.e("Alert","btn uncaughtException::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException222",Toast.LENGTH_LONG).show(); View buttone = null; setContentView(buttone); } }); Button btnHello2 =new Button(this); btnHello2.setText("I am a EEROR Try n catch"); btnHello2.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { try{ View buttone = null; setContentView(buttone); } catch (Exception e) { Log.e("Alert","Try n catch:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert Try n catch",Toast.LENGTH_LONG).show(); setContentView(MyLayout()); } } }); mainLayout.addView(btnHello); mainLayout.addView(btnHello2); return mainLayout; } public void myHandaling(Thread pairamThread, Throwable pairamThrowable){ Log.e("Alert","Lets See if it Works !!!" +"pairamThread:::" +pairamThread +"pairamThrowable:::" +pairamThrowable); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException111",Toast.LENGTH_LONG).show(); Intent in =new Intent(ForceCloseExceptionHandalingActivity.this,com.satya.ForceCloseExceptionHandaling.ForceCloseExceptionHandalingActivity.class); stairtActivity(in); finish(); android.os.Process.killProcess(android.os.Process.myPid()); } @Oviewride protected void onDestroy() { Log.e("Alert","onDestroy:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert onDestroy",Toast.LENGTH_LONG).show(); super.onDestroy(); } } public class ForceCloseExceptionHandalingActivity extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setContentView(MyLayout()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Oviewride public void uncaughtException(Thread pairamThread, Throwable pairamThrowable) { myHandaling(pairamThread, pairamThrowable); } }); } private ViewGroup MyLayout(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("Show all button"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { setContentView(MyLayout2()); } }); mainLayout.addView(btnHello); return mainLayout; } private ViewGroup MyLayout2(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("I am a EEROR uncaughtException"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Log.e("Alert","btn uncaughtException::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException222",Toast.LENGTH_LONG).show(); View buttone = null; setContentView(buttone); } }); Button btnHello2 =new Button(this); btnHello2.setText("I am a EEROR Try n catch"); btnHello2.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { try{ View buttone = null; setContentView(buttone); } catch (Exception e) { Log.e("Alert","Try n catch:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert Try n catch",Toast.LENGTH_LONG).show(); setContentView(MyLayout()); } } }); mainLayout.addView(btnHello); mainLayout.addView(btnHello2); return mainLayout; } public void myHandaling(Thread pairamThread, Throwable pairamThrowable){ Log.e("Alert","Lets See if it Works !!!" +"pairamThread:::" +pairamThread +"pairamThrowable:::" +pairamThrowable); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException111",Toast.LENGTH_LONG).show(); Intent in =new Intent(ForceCloseExceptionHandalingActivity.this,com.satya.ForceCloseExceptionHandaling.ForceCloseExceptionHandalingActivity.class); stairtActivity(in); finish(); android.os.Process.killProcess(android.os.Process.myPid()); } @Oviewride protected void onDestroy() { Log.e("Alert","onDestroy:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert onDestroy",Toast.LENGTH_LONG).show(); super.onDestroy(); } } public class ForceCloseExceptionHandalingActivity extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setContentView(MyLayout()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Oviewride public void uncaughtException(Thread pairamThread, Throwable pairamThrowable) { myHandaling(pairamThread, pairamThrowable); } }); } private ViewGroup MyLayout(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("Show all button"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { setContentView(MyLayout2()); } }); mainLayout.addView(btnHello); return mainLayout; } private ViewGroup MyLayout2(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("I am a EEROR uncaughtException"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Log.e("Alert","btn uncaughtException::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException222",Toast.LENGTH_LONG).show(); View buttone = null; setContentView(buttone); } }); Button btnHello2 =new Button(this); btnHello2.setText("I am a EEROR Try n catch"); btnHello2.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { try{ View buttone = null; setContentView(buttone); } catch (Exception e) { Log.e("Alert","Try n catch:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert Try n catch",Toast.LENGTH_LONG).show(); setContentView(MyLayout()); } } }); mainLayout.addView(btnHello); mainLayout.addView(btnHello2); return mainLayout; } public void myHandaling(Thread pairamThread, Throwable pairamThrowable){ Log.e("Alert","Lets See if it Works !!!" +"pairamThread:::" +pairamThread +"pairamThrowable:::" +pairamThrowable); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException111",Toast.LENGTH_LONG).show(); Intent in =new Intent(ForceCloseExceptionHandalingActivity.this,com.satya.ForceCloseExceptionHandaling.ForceCloseExceptionHandalingActivity.class); stairtActivity(in); finish(); android.os.Process.killProcess(android.os.Process.myPid()); } @Oviewride protected void onDestroy() { Log.e("Alert","onDestroy:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert onDestroy",Toast.LENGTH_LONG).show(); super.onDestroy(); } }); public class ForceCloseExceptionHandalingActivity extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setContentView(MyLayout()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Oviewride public void uncaughtException(Thread pairamThread, Throwable pairamThrowable) { myHandaling(pairamThread, pairamThrowable); } }); } private ViewGroup MyLayout(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("Show all button"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { setContentView(MyLayout2()); } }); mainLayout.addView(btnHello); return mainLayout; } private ViewGroup MyLayout2(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("I am a EEROR uncaughtException"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Log.e("Alert","btn uncaughtException::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException222",Toast.LENGTH_LONG).show(); View buttone = null; setContentView(buttone); } }); Button btnHello2 =new Button(this); btnHello2.setText("I am a EEROR Try n catch"); btnHello2.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { try{ View buttone = null; setContentView(buttone); } catch (Exception e) { Log.e("Alert","Try n catch:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert Try n catch",Toast.LENGTH_LONG).show(); setContentView(MyLayout()); } } }); mainLayout.addView(btnHello); mainLayout.addView(btnHello2); return mainLayout; } public void myHandaling(Thread pairamThread, Throwable pairamThrowable){ Log.e("Alert","Lets See if it Works !!!" +"pairamThread:::" +pairamThread +"pairamThrowable:::" +pairamThrowable); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException111",Toast.LENGTH_LONG).show(); Intent in =new Intent(ForceCloseExceptionHandalingActivity.this,com.satya.ForceCloseExceptionHandaling.ForceCloseExceptionHandalingActivity.class); stairtActivity(in); finish(); android.os.Process.killProcess(android.os.Process.myPid()); } @Oviewride protected void onDestroy() { Log.e("Alert","onDestroy:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert onDestroy",Toast.LENGTH_LONG).show(); super.onDestroy(); } } public class ForceCloseExceptionHandalingActivity extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setContentView(MyLayout()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Oviewride public void uncaughtException(Thread pairamThread, Throwable pairamThrowable) { myHandaling(pairamThread, pairamThrowable); } }); } private ViewGroup MyLayout(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("Show all button"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { setContentView(MyLayout2()); } }); mainLayout.addView(btnHello); return mainLayout; } private ViewGroup MyLayout2(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("I am a EEROR uncaughtException"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Log.e("Alert","btn uncaughtException::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException222",Toast.LENGTH_LONG).show(); View buttone = null; setContentView(buttone); } }); Button btnHello2 =new Button(this); btnHello2.setText("I am a EEROR Try n catch"); btnHello2.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { try{ View buttone = null; setContentView(buttone); } catch (Exception e) { Log.e("Alert","Try n catch:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert Try n catch",Toast.LENGTH_LONG).show(); setContentView(MyLayout()); } } }); mainLayout.addView(btnHello); mainLayout.addView(btnHello2); return mainLayout; } public void myHandaling(Thread pairamThread, Throwable pairamThrowable){ Log.e("Alert","Lets See if it Works !!!" +"pairamThread:::" +pairamThread +"pairamThrowable:::" +pairamThrowable); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException111",Toast.LENGTH_LONG).show(); Intent in =new Intent(ForceCloseExceptionHandalingActivity.this,com.satya.ForceCloseExceptionHandaling.ForceCloseExceptionHandalingActivity.class); stairtActivity(in); finish(); android.os.Process.killProcess(android.os.Process.myPid()); } @Oviewride protected void onDestroy() { Log.e("Alert","onDestroy:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert onDestroy",Toast.LENGTH_LONG).show(); super.onDestroy(); } } public class ForceCloseExceptionHandalingActivity extends Activity { /** Called when the activity is first created. */ @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setContentView(MyLayout()); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Oviewride public void uncaughtException(Thread pairamThread, Throwable pairamThrowable) { myHandaling(pairamThread, pairamThrowable); } }); } private ViewGroup MyLayout(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("Show all button"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { setContentView(MyLayout2()); } }); mainLayout.addView(btnHello); return mainLayout; } private ViewGroup MyLayout2(){ LineairLayout mainLayout = new LineairLayout(this); mainLayout.setOrientation(LineairLayout.VERTICAL); Button btnHello =new Button(this); btnHello.setText("I am a EEROR uncaughtException"); btnHello.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { Log.e("Alert","btn uncaughtException::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException222",Toast.LENGTH_LONG).show(); View buttone = null; setContentView(buttone); } }); Button btnHello2 =new Button(this); btnHello2.setText("I am a EEROR Try n catch"); btnHello2.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { try{ View buttone = null; setContentView(buttone); } catch (Exception e) { Log.e("Alert","Try n catch:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert Try n catch",Toast.LENGTH_LONG).show(); setContentView(MyLayout()); } } }); mainLayout.addView(btnHello); mainLayout.addView(btnHello2); return mainLayout; } public void myHandaling(Thread pairamThread, Throwable pairamThrowable){ Log.e("Alert","Lets See if it Works !!!" +"pairamThread:::" +pairamThread +"pairamThrowable:::" +pairamThrowable); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert uncaughtException111",Toast.LENGTH_LONG).show(); Intent in =new Intent(ForceCloseExceptionHandalingActivity.this,com.satya.ForceCloseExceptionHandaling.ForceCloseExceptionHandalingActivity.class); stairtActivity(in); finish(); android.os.Process.killProcess(android.os.Process.myPid()); } @Oviewride protected void onDestroy() { Log.e("Alert","onDestroy:::"); Toast.makeText(ForceCloseExceptionHandalingActivity.this, "Alert onDestroy",Toast.LENGTH_LONG).show(); super.onDestroy(); } 
Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.