I have the next crash when I try to launch an Activity:
2019-10-24 15:12:29.887 4245-4296/fr.zapotec.eliodroid.tv E/AndroidRuntime: FATAL EXCEPTION: Thread-6
Process: fr.zapotec.eliodroid.tv, PID: 4245
java.lang.IllegalArgumentException: setTaskFromReuseOrCreateNewTask: task=TaskRecord{6e69142 #1643 A=fr.zapotec.eliodroid.tv U=0 StackId=1 sz=3} is in a different stack (1) than the parent of r=ActivityRecord{8062424 u0 fr.zapotec.eliodroid.tv/fr.zapotec.eliodroid.SplashActivity t1644} (0)
at android.os.Parcel.readException(Parcel.java:1955)
at android.os.Parcel.readException(Parcel.java:1897)
at android.app.IActivityManager$Stub$Proxy.startActivities(IActivityManager.java:6812)
at android.app.Instrumentation.execStartActivitiesAsUser(Instrumentation.java:1677)
at android.app.Instrumentation.execStartActivities(Instrumentation.java:1632)
at android.app.ContextImpl.startActivities(ContextImpl.java:910)
at android.app.ContextImpl.startActivities(ContextImpl.java:884)
at android.content.ContextWrapper.startActivities(ContextWrapper.java:399)
at fr.zapotec.eliodroid.utils.LaunchActivityUtils.launchTVLastProgram(LaunchActivityUtils.java:22)
at fr.zapotec.eliodroid.standby.StandbyManager.launchAction(StandbyManager.java:253)
at fr.zapotec.eliodroid.standby.StandbyManager.onEventReceived(StandbyManager.java:141)
at fr.zapotec.eliodroid.handset.HandsetEventDispatcherImpl.handleKeyPress(HandsetEventDispatcherImpl.java:229)
at fr.zapotec.eliodroid.handset.HandsetEventDispatcherImpl.handleKeyPress(HandsetEventDispatcherImpl.java:204)
at fr.zapotec.eliodroid.handset.HandsetEventDispatcherImpl.onMessageReceived(HandsetEventDispatcherImpl.java:165)
at fr.zapotec.handsetbluetooth.HandsetManagerImpl.dispatchMessage(HandsetManagerImpl.java:49)
at fr.zapotec.handsetbluetooth.MessageManager.onNewMessageReceived(MessageManager.java:119)
at fr.zapotec.handsetbluetooth.HandsetThread.listenAndWrite(HandsetThread.java:126)
at fr.zapotec.handsetbluetooth.HandsetThread.run(HandsetThread.java:56)
This is the Manifest file:
<activity
android:launchMode="singleTask"
android:name=".SplashActivity"
android:noHistory="true"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
<activity
android:launchMode="singleTask"
android:noHistory="true"
android:name=".StandbyActivity"/>
<activity
android:launchMode="singleTask"
android:name=".main.SimpleMainActivity"/>
<activity
android:launchMode="singleTask"
android:name=".main.InstallActivity"/>
I need the Activity 'SimpleMainActivity' to be one only instance (that's why the 'singleTask') This Activity can be launched due to Bluetooth events (triggered by a bluetooth device) or due to a given timing in a very specific situation.
The method which launches the Activity is:
startActivity(new Intent(context, MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK));
I have the crash when trying to launch the Activity from the 2 different sources almost at the same time.
Anyone knows how to solve this problem without removing the 'singleTask' from my Activity?
For information, my application is the "Default launcher", so "SplashActivity" maybe be launched if system needs to show the launcher. The SplashActivity only shows a splash screen and launches the first activity (SimpleMainActivity.class)
from IllegalArgumentException: setTaskFromReuseOrCreateNewTask
No comments:
Post a Comment