First, before looking at this blog, you can first read this blog, http://blog.csdn.net/harryweasley/article/details/50057707
There are two ways to get information about the application, one is PackageInfo, one is Resolveinfo, through the PackageInfo to get application information, there will be a bug, that is, if the app has more than one icon and name, then only the default display of the first. So I now use Resolveinfo to get user information.
For multiple icons and names, do not understand, you can read this article. http://blog.csdn.net/harryweasley/article/details/48051565
Look at the following:
There are four identical package names, but the same app with different icons and names.
Actually get all the application information on the desktop, or relatively simple, the following is the main code, the article Finally, will be posted resources.
Package Com.example.getlauncherapp;import Java.util.list;import Android.app.activity;import android.content.Intent ; Import Android.content.pm.packagemanager;import Android.content.pm.resolveinfo;import Android.os.Bundle;import Android.view.menu;import Android.view.menuitem;import Android.widget.listview;public class MainActivity extends Activity {private ListView mylistview; Private list<resolveinfo> resolveinfolist; @Override protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_main); Mylistview = (ListView) Findviewbyid (R.id.listview); Getlauncherapp (); Mybaseadapter adapter = new Mybaseadapter (this, resolveinfolist); Mylistview.setadapter (adapter); }/** * Get to the desktop application */private void Getlauncherapp () {//Desktop app launch in intent need to include Action_main and Category_hom E. Intent Intent = new Intent (); Intent.addcategory (Intent.category_launCHER); Intent.setaction (Intent.action_main); Packagemanager manager = Getpackagemanager (); Resolveinfolist = manager.queryintentactivities (Intent, 0); }}
Android Get desktop app