I can get the name of the application using this code:
PackageInfo appInfo = pm.getPackageInfo(packageName, 0);
String label = appInfo.applicationInfo.loadLabel(pm).toString();
It gives names of application in default locale. But I need in English.
I also tried:
int id = context.getResources().getIdentifier("app_name","string",packageName);
String label = context.getString(id);
But id == 0
always
Now my question is:
How to get the name of the application from resources res/values/strings.xml - app_name
, knowing the name of the package?
Any ideas?
To get the names of installed apps:
String appName = (String)pm.getApplicationLabel(appInfo);
The reason that the app_name
method is not working, is that this is a default, but is not always what is used.