When an application\'s process is killed, its activity stack is saved. Then when the application is restarted, all my activities resume and run into null pointers. Rather th
I use this piece of code:
public class NoRestoreActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// Shoul be always NULL when created the first time, just in case...
if (savedInstanceState != null && savedInstanceState.getInt("SavedInstance") > 0) {
// ----- Your prefferred way to kill an application ----
try {
this.finishActivity(0);
} catch (Exception ee) {
}
try {
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(10);
} catch (Exception eeee) {
}
return;
}
super.onCreate(savedInstanceState);
}
@Override
protected void onSaveInstanceState (Bundle outState){
super.onSaveInstanceState(outState);
outState.putInt("SavedInstance",1);
}
}