B.Cakir
B.Cakir

Reputation: 607

Android back button doesn't navigate back correctly

When clicking the back button, the app completely closes, instead of going back one activity in the back stack. How come?

To clarify:

A --> B - App launches and user clicks on a button that starts another activity.

A <-- B - User clicks back button and goes back to previous activity (this is what I expected to happen).

<-- B - User clicks back button and app completely closes (what actually happens).

Could it possibly be my manifest file?

Upvotes: 0

Views: 71

Answers (2)

Shahin
Shahin

Reputation: 397

It's not your Manifest. The Activity 'A' is Finished which only happens at intent.

Also, Check what is happening when you press Back Button while you are in Activity B.

Upvotes: 0

MilanNz
MilanNz

Reputation: 1341

This means that you probably started activity A with finish at the end. For example:

Intent intent = new Intent(this, B.class);
startActivity(intent);
finish();

Take a look more about back navigation on android developer documentation here.

Upvotes: 3

Related Questions