public CharSequence getApplicationLabel(Context context, String pkgName){
try {
PackageManager pm = context.getPackageManager();
ApplicationInfo appInfo = pm.getApplicationInfo(pkgName, PackageManager.GET_META_DATA);
return pm.getApplicationLabel(appInfo);
}
catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return null;
}
}
网友评论