Android organize apps alphabetically

Android-organize-apps-alphabetically-featured.png

I’m trying understand this ListView working and i am attempting to sort their email list alphabetically through the application title rather than the package title.

MainActivity.java

// load list application
mListAppInfo = (ListView)findViewById(R.id.lvApps)
// create new adapter
AppInfoAdapter adapter = new AppInfoAdapter(this, Utilities.getInstalledApplication(this), getPackageManager())
// set adapter to list out view
mListAppInfo.setAdapter(adapter)

AppInfoAdapter.java

public AppInfoAdapter(Context c, List list, PackageManager pm)

public View getView(int position, View convertView, ViewGroup parent) obtain the selected entry
ApplicationInfo entry = (ApplicationInfo) mListAppInfo.get(position)

// mention of the convertView
View v = convertView

// inflate new layout if null
if(v == null)

// load controls from layout assets
ImageView ivAppIcon = (ImageView)v.findViewById(R.id.ivIcon)
TextView tvAppName = (TextView)v.findViewById(R.id.tvName)
TextView tvPkgName = (TextView)v.findViewById(R.id.tvPack)

// set data to show
ivAppIcon.setImageDrawable(entry.loadIcon(mPackManager))
tvAppName.setText(entry.loadLabel(mPackManager))
tvPkgName.setText(entry.packageName)

// return view
return v

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>