PHP
·
发表于 5年以前
·
阅读量:8390
/**
* 获取应用程序名称
*/
public static String getAppName(Context context,String packageId)
{
try
{
PackageManager packageManager = context.getPackageManager();
PackageInfo packageInfo = packageManager.getPackageInfo(packageId, 0);
return packageInfo.applicationInfo.loadLabel(packageManager).toString();
} catch (NameNotFoundException e)
{
e.printStackTrace();
}
return null;
}