I have two activity. One of these is a sort of home activity (with some choises) and the other is the main activity. Use do this:
<activity
android:name=".Home"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
</activity>
And in Home.java i set:
@Override
protected void onPause() {
super.onPause();
finish();
}
@Override
protected void onStop() {
super.onStop();
finish();
}
In MainActivity.java
I do nothing in method onPause()
and onStop()
.
The problem is that if in MainActivity I set back, the app is in my background app and I can see the screen of MainActivity.
But when I restart the app, it restart with Home.
Well, how can I restart with MainActivity? Thanks