Get the launcher Activity name of an android application

android, android-activity

Solution

Use the following code to get the launcher activity of all packages:

final PackageManager pm = getPackageManager();

Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);

List<ResolveInfo> appList = pm.queryIntentActivities(mainIntent, 0);
Collections.sort(appList, new ResolveInfo.DisplayNameComparator(pm));

for (ResolveInfo temp : appList) {
    Log.v("my logs", "package and activity name = "
            + temp.activityInfo.packageName + "    "
            + temp.activityInfo.name);
}

Problem

I need to get the name of launcher activity to launch the activity from my application. Any solution

Original source

Related problems