Vik0809
Vik0809

Reputation: 379

How to determine the real names programms

at the moment only the package names are displayed (see picture): enter image description here

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

Answers (3)

NamNH
NamNH

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

Mattia Maestrini
Mattia Maestrini

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

Endzeit
Endzeit

Reputation: 5474

Refering to this similar post the following should work:

packetName = packageInfo.applicationInfo.loadLabel(pm).toString();

Upvotes: 3

Related Questions