Android get target app display name

Each app has a display name in Settings-App.

    String getApplicationDisplayName(Context ctx, String packageName) throws PackageManager.NameNotFoundException {
        PackageManager pm = ctx.getPackageManager();
        ApplicationInfo info = pm.getApplicationInfo(packageName, 0);
        String displayName = info.loadLabel(pm).toString();
        Log.v(TAG, "GetApplicationDisplayName: Application display name is: " + displayName);
        return displayName;
    }

Outputs:

GetApplicationDisplayName: Application display name is: AnTuTu Benchmark

你可能感兴趣的:(Android get target app display name)