I am trying to load a list of all installed packages on the device. However, when I do this, any installed Live Wallpapers do not show up on the list... Is there a way to fix this?
Here's my code:
final PackageManager pm = this.getPackageManager();
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
final ArrayList<ResolveInfo> list =
(ArrayList<ResolveInfo>) pm.queryIntentActivities(intent,
PackageManager.PERMISSION_GRANTED);
for (ResolveInfo rInfo : list)
{
Log.i(TAG, ": Installed Applications " + rInfo.activityInfo.
applicationInfo.loadLabel(pm).toString());
}
final ArrayAdapter<ResolveInfo> adapter =
new ArrayAdapter<ResolveInfo>(this, R.layout.list_item, list)
{
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
if (convertView == null)
convertView = LayoutInflater.from(parent.getContext()).
inflate(R.layout.list_item, parent, false);
final String text = list.get(position).activityInfo.
applicationInfo.loadLabel(pm).toString();
((TextView)convertView.findViewById(R.id.text)).setText(text);
final Drawable drawable = list.get(position).activityInfo.applicationInfo.loadIcon(pm);
((ImageView)convertView.findViewById(R.id.image)).setImageDrawable(drawable);
return convertView;
}
};
setListAdapter(adapter);
ListView lv = getListView();
lv.setTextFilterEnabled(true);