To control your back presses, you can basically direct each activity or fragment to go wherever you which on back press by overriding the backpress event.
@Override
public void onBackPressed() {
// TO DO
}
To also handle backpress and state with fragments, it is advisable to manage the back stack.
Providing Proper Back Navigation
I also use a custom home button on my apps when I want the user to be able to go straight back to the main activity.
public void goHome() {
startActivity(new Intent(this, MainActivity.class));
}
edit
this was part of my original answer, but it was not addressing what the OP was asking. I left it here in case it helps any browsers who may also have misinterpreted the question and are looking for something like this.
You need to set your main activity to be the launcher activity for the app and then use BOOT_COMPLETED and DEFAULT. This means the user will have to choose a default option each time they press the home key, until they either set the app or the default device homescreen to 'always' be the default.
<activity android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>