List of all installed applications

Asked

Viewed 570 times

1

I’m wanting to learn how to create a list with all the apps installed from Android. How do I show in a ListView all apps installed on the smartphone?

2 answers

0

Following the code to get the list of activities/apps 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 helped, any doubt just call.

  • I’m ignorant on how to use this code. Do I need a program to run it? Or on mobile has a right place to run?

  • If you have doubts about where to put this code, your doubt is much greater than you demonstrated in the question. Start from the beginning and gradually increase your knowledge. You can’t start from the top.

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));

Browser other questions tagged

You are not signed in. Login or sign up in order to post.