Bring task with activity stack to front knowing package name
I have the following scenario.
I run application A with known packagename that starts Activity A1 as the main activity from the launcher. Now from A1 I launch another activity of this application that possibly is a settings activity or something else, let's call it A2. So our stack is A1-A2.
Now I switch back to the homescreen by pressing home. I start another application, let's call it B. B now wants to be able to switch back to the c开发者_运维问答urrently paused A application preserving its activity stack. That would mean we have B-A1-A2 at the end. Is that possible in general? Please note that I only know the package name of A and do not have any more information about application A.
Here is what I already tried without success:
Intent intent = getPackageManager().getLaunchIntentForPackage(PKGNAME);
if(intent!=null)
{
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
finish();
}
But this gives B-A1-A2-A1.
精彩评论