How to add a dynamically resolved activity name to the back stack (without using PARENT_ACTIVITY)?
- by user3214249
The goal is
1) Start activity A from AppWidgetProvider or any other background task (it is simple).
2) From activity A go to activity B after clicking Back button.
The problem is that I can't set PARENT_ACTIVITY in AndroidManifest.xml, because the activity B class name gets determined at run time. So in one case I need to go to activity B, in other case it is another activity. Seems like I can't use TaskStackBuilder without PARENT_ACTIVITY.
I could handle this in the finish() method of activity A, but it should be a simpler way to add activity B to the "back stack" when I run startActivity(intent). Any ideas?