I want to be able to get the string package name and icon of all the applications installed in my phone. What I have done: Browsed and found this solution
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List pkgAppsList = this.getPackageManager().queryIntentActivities(mainIntent, 0);
for(int counter = 0; counter<=pkgAppsList.size()-1;counter++)
{
Log.e("TAG", pkgAppsList.get(counter).toString());
}
The problem is that it displays package and class name as as a as a mix and I can't get the icon. What I want is to show the user a list of all the applications installed on the phone with the icon. And I also need to be able to get the package name with a List.OnItemClickListener
. I assume that using an array of app names and package name which are of same positioning I can do that. But how would I get the app icon and name with package name. Preferably as an Array or ArrayList that I can convert into a listView object. If there is any alternative method even let me know. I am still a beginner in Android.
And please do help.