How to start an Intent from a ResolveInfo
Given a ResolveInfo
named launchable
:
ActivityInfo activity=launchable.activityInfo;ComponentName name=new ComponentName(activity.applicationInfo.packageName, activity.name);Intent i=new Intent(Intent.ACTION_MAIN);i.addCategory(Intent.CATEGORY_LAUNCHER);i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);i.setComponent(name);startActivity(i);
(from https://github.com/commonsguy/cw-omnibus/tree/master/Introspection/Launchalot)
Create an new Intent by this way.
Intent intent = new Intent(); intent.setClassName(resolveInfo.activityInfo.applicationInfo.packageName, resolveInfo.activityInfo.name); startActivity(intent);