Android moving back to first activity on button click

button.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
        startActivity(new Intent(D.this, A.class));
    }
});

Declare A in your manifest with the android:launchMode="singleTask". This way, when you call startActivity() from your other activies, and A is already running, it will just bring it to the front. Otherwise it’ll launch a new instance.

Leave a Comment