views:

2262

answers:

2

I asked a similar question to this earlier this week but I'm still not understanding how to get a list of all installed applications and then pick one to run.

I've tried:

Intent intent = new Intent(ACTION_MAIN);
intent.addCategory(CATEGORY_LAUNCHER);

and this only shows application that are preinstalled or can run the ACTION_MAIN Intent type.

I also know I can use PackageManager to get all the installed applications, but how do I use this to run a specific application?

Thanks

+5  A: 

Following is the code to get the list of activities/applications installed on Android :

final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List pkgAppsList = context.getPackageManager().queryIntentActivities( mainIntent, 0);

You will get all the necessary data in the ResolveInfo to start a application. You can check ResolveInfo javadoc here.

HTH !

Karan
How can I start one of these? I got the activityInfo inside ResolveInfo, but I can't manage to start it.
Spidey
Nevermind, found it. I should create a new Intent using the full class name (package + class).
Spidey
A: 

thanks karan It working fine.

Have u any idea to hide Icon of any specific Application Icon.

Thanks in Advance

Shubh