List of all installed applications

1

I'm trying to learn how to build a list of all installed Android applications. How do I show in a ListView all the applications installed on the smartphone?

    
asked by anonymous 19.07.2015 / 02:38

2 answers

0

Following the code to get the list of activities / applications installed on Android:

final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List pkgAppsList = context.getPackageManager().queryIntentActivities( mainIntent, 0);

I hope it has helped, any questions just call.

    
19.07.2015 / 02:48
0

Follows:

   PackageManager packageManager=getPackageManager();
        List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_META_DATA);
        List<String> values = new ArrayList<String>(0);
        for(ApplicationInfo ap:list){
            values.add(ap.packageName);
        }
        ListView lista =  ListView.class.cast(findViewById(R.id.lista));
        lista.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, values));
    
19.07.2015 / 02:55