If my procedure is as follows:
- Starting Activity A β Activity B
- Click the Home button.
- Click the app again.
Result: activity B is displayed (it resumes ).
- Starting Activity A β Activity B
- Click the back button.
- Click the app again.
Result: activity βAβ is displayed (it restarts ).
I want to do the same from BroadcastReceiver.
- Starting Activity A β Activity B
- Click the Home button.
- BroadcastReceiver receives the broadcast and wants to βresumeβ the application.
Expected Result: Activity B is displayed.
I want to do the same from BroadcastReceiver.
- Starting Activity A β Activity B
- Click the back button.
- BroadcastReceiver receives broadcast and wants to "restart" the application.
Current result: Activity A is displayed.
The following code does not fulfill what I expect:
public void onReceive(Context context, Intent intent) { Intent i = new Intent(context, ActivityA.class); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); }
I also tried "Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY", but no luck.
source share