Skip to content

Instantly share code, notes, and snippets.

@creativedrewy
Created August 21, 2012 04:35
Show Gist options
  • Save creativedrewy/3411593 to your computer and use it in GitHub Desktop.
Save creativedrewy/3411593 to your computer and use it in GitHub Desktop.
Android List of Installed Apps
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
lView = (ListView) findViewById(R.id.list1);
PackageManager pm = this.getPackageManager();
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
List list = pm.queryIntentActivities(intent, PackageManager.PERMISSION_GRANTED);
for (ResolveInfo rInfo : list) {
results.add(rInfo.activityInfo.applicationInfo.loadLabel(pm).toString());
Log.w("Installed Applications", rInfo.activityInfo.applicationInfo.loadLabel(pm).toString());
}
lView.setAdapter(new ArrayAdapter(this, android.R.layout.simple_ list_item_1, results));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment