Reputation: 379
at the moment only the package names are displayed (see picture):
what I want is: SlimLauncher for example instead of com.slim.slimlauncher
The corressponding code is:
final PackageManager pm = getPackageManager ();
List< ApplicationInfo > packages = pm.getInstalledApplications ( PackageManager.GET_META_DATA );
View inflate = getLayoutInflater(). inflate(R. layout. anwendung_starten_layout, null);
String packetName = null;
for ( ApplicationInfo packageInfo : packages ) {
packetName = packageInfo.packageName;
kinder.add ( packetName );
}
Thanks a lot
Upvotes: 2
Views: 107
Reputation: 1805
You can read PackageManager->getApplicationLabel(ApplicationInfo info) API from this link . With your code, try this:
packetName = pm.getApplicationLabel(packageInfo)
Regards !
Upvotes: 2
Reputation: 32780
Use PackageManager.getApplicationLabel(ApplicationInfo info):
final PackageManager pm = getPackageManager ();
List< ApplicationInfo > packages = pm.getInstalledApplications ( PackageManager.GET_META_DATA );
View inflate = getLayoutInflater(). inflate(R. layout. anwendung_starten_layout, null);
String applicationName = null;
String packetName = null;
for ( ApplicationInfo packageInfo : packages ) {
applicationName = pm.getApplicationLabel(packageInfo);
packetName = packageInfo.packageName;
kinder.add ( packetName );
}
Upvotes: 3
Reputation: 5474
Refering to this similar post the following should work:
packetName = packageInfo.applicationInfo.loadLabel(pm).toString();
Upvotes: 3