Android Get desktop app

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.