Commit 214a6dfe authored by Christophe Beyls's avatar Christophe Beyls

Enhance up navigation from track Activity to main Activity: don't re-create the main Activity

Closes #7, closes #23
parent d7e888bb
......@@ -4,6 +4,7 @@ import android.content.Intent;
import android.nfc.NdefRecord;
import android.os.Bundle;
import android.widget.ImageButton;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
......@@ -114,6 +115,14 @@ public class TrackScheduleActivity extends AppCompatActivity
}
}
@Override
public void supportNavigateUpTo(@NonNull Intent upIntent) {
// Add FLAG_ACTIVITY_SINGLE_TOP to ensure the Main activity in the back stack is not re-created
upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(upIntent);
finish();
}
// TrackScheduleListFragment.Callbacks
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment