then in my app there are 103 activity, in sequence SplashActivity -> Menu ---> Q_001 ---> Q_002 ... (...) ..... Q_finish. in each of the activity I have a button to put exit from the app (like a home button), and a button that returns to the Menu. Now I want that if the user kills the app, and open it at another time returns to the activity that was using,
I know I have to try to change the SpalshActivity The last activity you were doing, if you were not carrying out any activity to continue His Work this is the code of SplashActivity:
package org.somename;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle TravisIsAwesome) {
super.onCreate(TravisIsAwesome);
setContentView(R.layout.splash);
Thread logoTimer = new Thread (){
@Override
public void run(){
try{
sleep(500);
Intent menuIntent = new Intent("org.somename.MENU");
startActivity(menuIntent);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
finish();
}
}
};
logoTimer.start();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
keep saying that I do not care about saving activity menu, but all the activities starting from "Q_001" and ending activity "Q_finish." I tried to use new this method: I have suggested in the previous question and I have implemented this code:
package org.somename;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle TravisIsAwesome) {
super.onCreate(TravisIsAwesome);
setContentView(R.layout.splash);
int last_activity = getLastActivityIdFromSharedPreferences();
if (last_activity == 1)
{
this.startActivity(new Intent(this, Q_001.class));
finish();
}
int last_activity2 = getLastActivityIdFromSharedPreferences2();
if (last_activity2 == 2)
{
this.startActivity(new Intent(this, Q_002.class));
finish();
}
Thread logoTimer = new Thread (){
@Override
public void run(){
try{
sleep(500);
Intent menuIntent = new Intent("org.somename.MENU");
startActivity(menuIntent);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
finish();
}
}
};
logoTimer.start();
}
private int getLastActivityIdFromSharedPreferences2() {
// TODO Auto-generated method stub
return 2;
}
private int getLastActivityIdFromSharedPreferences() {
// TODO Auto-generated method stub
return 1;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
but it is not part of the SplahActivity, and does not return to the Activity executed . goes directly to the menu, with a SplahActivity of blank page
Thank in advance