Created
August 21, 2012 04:35
-
-
Save creativedrewy/3411593 to your computer and use it in GitHub Desktop.
Android List of Installed Apps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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