I use the code below to get the launcher activity name belongs to specific package name:
Intent intent = new Intent();
intent.setPackage(aPackageName);
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
ResolveInfo result = getPackageManager().resolveActivity(intent, 0);
I save result.activityInfo.name to shared preference
Later I want to start this activity, but how to get its package name?
or, Is it possible to start this activity without knowing the package name it belongs to?
Intent launchIntent =
getPackageManager().getLaunchIntentForPackage(How to get the package name);
if(launchIntent != null){
startActivity(launchIntent);
}
Knowing that the activity(s) name(s) that I save are not mine.