Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Please check out my solution for getting the list of icon of application</p> <p>In this getting the list of <a href="http://developer.android.com/reference/android/content/pm/ResolveInfo.html" rel="nofollow">ResolveInfo</a> of all application. </p> <p>resolveInfo class contain Information that is returned from resolving an intent against an IntentFilter. This partially corresponds to information collected from the AndroidManifest.xml's tags</p> <p>This is the way to get the list of icon of application in android, hope this example will be help for you</p> <pre><code> import java.util.List; import android.app.ListActivity; import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; public class IconListActivity extends ListActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); loadApps(); } private void loadApps() { Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); List&lt;ResolveInfo&gt; mApps = getPackageManager().queryIntentActivities(mainIntent, 0); ListView listView = getListView(); listView.setAdapter(new AppsAdapter(this,mApps)); } public class AppsAdapter extends BaseAdapter { private LayoutInflater inflater; private List&lt;ResolveInfo&gt; mApps; public AppsAdapter(Context context, List&lt;ResolveInfo&gt; mApps) { this.inflater = LayoutInflater.from(context); this.mApps = mApps; } public View getView(int position, View convertView, ViewGroup parent) { ViewHendler hendler; if (convertView == null) { convertView = inflater.inflate(R.layout.row_view, null); hendler = new ViewHendler(); hendler.textLable = (TextView)convertView.findViewById(R.id.textViewLable); hendler.iconImage = (ImageView)convertView.findViewById(R.id.imageViewIcon); convertView.setTag(hendler); } else { hendler = (ViewHendler)convertView.getTag(); } ResolveInfo info = this.mApps.get(position); hendler.iconImage.setImageDrawable(info.loadIcon(getPackageManager())); hendler.textLable.setText(info.loadLabel(getPackageManager())); return convertView; } class ViewHendler{ TextView textLable; ImageView iconImage; } public final int getCount() { return mApps.size(); } public final Object getItem(int position) { return mApps.get(position); } public final long getItemId(int position) { return position; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload