I have a main activity, that when I click on a button, starts a new activity, i used the following code to do so:
Intent intent = new Intent(this, SettingsActivity.class);
I think you call the
MainActivity when you start the your
Mistakenly either you set the
android:noHistory = "true" in
MainActivity in AndroidManifest.xml.
On pressing the back key the activity automatically
Before you switch to your 'SettingsActivity', you have called finish() in your MainActivity, which causes pressing button go back to main screen since MainActivity was already killed.