Im developing an Android app in eclipse.
I have a list showing the applications installed, the list is this:
//Listar apps instaladas
final ListView list1 = (ListView) findViewById(R.id.list1);
ArrayList results = new ArrayList();
PackageManager pm = this.getPackageManager();
Intent inte = new Intent(Intent.ACTION_MAIN, null);
inte.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> list = pm.queryIntentActivities(inte, PackageManager.PERMISSION_GRANTED);
for (ResolveInfo rInfo : list) {
results.add(rInfo.activityInfo.applicationInfo.loadLabel(pm).toString());
}
list1.setAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, results));
My questions are: How I can do that instead of showing the icons name? if I do it
results.add(rInfo.activityInfo.applicationInfo.loadLabel(pm).toString());
show me "android.graphics.drawable @ name of the application" And how I can do to run the application by clicking on the list? I tried several attempts, but I make the application error. Thanks!
results.add(rInfo.activityInfo.applicationInfo.loadLabel(pm).toString()); with this line of code I assume you're loading the label of the application, so perhaps you should try loadName or something, check what you can pick there anyway since I haven't done this myself before.
And which error do you get when you click the list? this would be helpful too :)