Question

I'd like to resume any activity in my application to default one.

Is it possible or not?

Was it helpful?

Solution

You mean resume it after home is pressed ? If yes than

@Override
protected void onRestart() {
    // TODO Auto-generated method stub
    super.onRestart();
    startActivity(new Intent(Activity1.this,DefaultActivity.class));
}

OTHER TIPS

Solution can be:
1. You can overwrite onresume method of activity and can start desire activity with clear stack trace after finishing the current activity.

yes . possible . keep delault activity alone into history stack .

this you can achieve by setting noHistory=true (in AndroidManifest) for all the activities except the default one . alternatively you can set same thing by java code using appropriate flag along with intent of startActivity . Now on back press , app will navigate to default screen always .

in case this default screen is not the first one approach might be :

you can create a method which will navigate user to that screen and call it in onBackPress() of all activities .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top