2

I want to make a list of both installed and system applications separately.Below is my code

List<ApplicationInfo> appList = packageManager.getInstalledApplications(0);
if(appList != null && !appList.isEmpty()){
        for (ApplicationInfo appInfo : appList) {
        Intent intent = packageManager.getLaunchIntentForPackage(appInfo.packageName);
        if(intent != null){
            ComponentName componentName = intent.getComponent();
            if((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
                //It is a system app
            }else{
                //It is an installed app.
            }
        }
    }
}

I want to launch each app on click of listview.But the componentName .getClassName() shows as "com.android.internal.app.ResolverActivity" for some applications like Contacts,Map etc....How can i get exact class name of such type of applications.I could not use ResolveInfo because it is difficult to categorize applications.

How to get exact class name of applications using package name ?

Thanks in Advance

Rob
  • 4,927
  • 12
  • 49
  • 54
Devu Soman
  • 2,246
  • 13
  • 36
  • 57
  • I ran your sample code on a Galaxy Nexus running 4.2.2, and I didn't get any installed applications showing as ResolverActivity. Can you give us a little more background? What are you running this on? Maybe this isn't a direct path to your answer...but you've got me curious why you're seeing ResolverActivity and I'm not. – Todd Sjolander Mar 25 '13 at 12:11
  • I used Galaxy Tab 2.2 – Devu Soman Mar 25 '13 at 12:13

1 Answers1

-1

You can ask the packageManager:

CharSequence label = "";
for (ApplicationInfo appInfo : appList)    
    label = packageManager.getApplicationLabel(appInfo);
heila
  • 29
  • 2