Launch Main Activity only one time on Android

Use android:launchMode="singleTop" to make sure that a new instance of MainActivity isn't spawned when you press the back button. Spawning a new instance of MainActivity is not memory efficient.

Then, in the actual SettingsActivity you should override the home button to act like the back button:
if (id == android.R.id.home) {
    onBackPressed();
}
and you should display home as up, to allow up navigation:
this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);

Bu blogdaki popüler yayınlar

About Android padding, margin, width, height, wrap_content, match_parent, R Class

@SerializedName and @Expose annotations