Issue
I have 3 activities, then I navigate from A to B and from B to C. The stack are C-B-A (with C on the top). The C Activity have a Runnable that works every interval, and connect to a web service that update the UI. If the Activity C comes to background, is destroyed and then comes to foreground again the task starts with de main Activity A. I want to come back to the C activity. Is possible?
In the emulator works fine but in my smartphone with only this application running, always destory the entire application.. can I do somthing? If I do a service separated from the UI, could improve this?
Edit2: I try this declaration on AndroidManifest
<activity android:name=".ActivityA" android:label="@string/app_name"
android:alwaysRetainTaskState="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="oauthht" android:host="hattrick"/>
</intent-filter>
</activity>
<activity android:name=".ActivityB" android:label="@string/ActivityB"
android:screenOrientation="portrait"></activity>
<activity android:name=".ActivityC" android:label="@string/ActivityC"
android:screenOrientation="portrait"
android:launchMode="singleTask">
Edit2: And the code to call the activities:
In the main Activity A:
public void onClickButtonB(View button) {
Intent intent = new Intent();
intent.setComponent(new ComponentName(this,ActivityB.class));
startActivity(intent);
}
In the Activity B:
Bundle bundle = new Bundle();
bundle.putLong("selectedMatch", matchID);
Intent liveIntent = new Intent();
liveIntent.setComponent(new ComponentName(ActivityB.this, ActivityC.class));
liveIntent.putExtras(bundle);
startActivity(liveIntent);
Solution
I know which was the problem. The application crashes in background but the exception was caught. This restarts the app in background and mislead me. :-S
Answered By - Andreu
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.