How to get a list of installed android applications and pick one to run

后端 未结 19 1838
误落风尘
误落风尘 2020-11-21 06:26

I asked a similar question to this earlier this week but I\'m still not understanding how to get a list of all installed applications and then pick one to run.

I\'v

19条回答
  •  孤街浪徒
    2020-11-21 07:14

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

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

    You will get all the necessary data in the ResolveInfo to start a application. You can check ResolveInfo javadoc here.

提交回复
热议问题