Basically I want to do an if statement like below, but I don't know how.
if (Android_Classes_Left_Open){
Intent a = new Intent(SplashScreen.this, 2ndtoTopElement.class);
startActivity(a);
} else {
Intent a = new Intent(SplashScreen.this, Other.class);
startActivity(a);
}
My SplashScreen code so far:
public class SplashScreen extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(SplashScreen.this, First.class);
startActivity(i);
finish();
}
}, 3000);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.splash, menu);
return true;
}
}
The purpose of this is, if the user moves the application into the background they are then returned to their most recently opened activity rather than starting the application from scratch each time. How can I achieve this?