Android Intent for standard operations, specifically Application Launcher
I'd like to add a button to my app that will show the list of applications. I开发者_StackOverflow社区 cannot seem to determine the correct Intent. I've been trying ACTION_ALL_APPS, but I get ActivityNotFound exception.
I don't think there is a standard activity that displays all applications. You need to retrieve a list of all applications and display it in your own list. You can retrieve all the applications with this code snippet
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
PackageManager packageManager = getContext().getPackageManager();
List<ResolveInfo> riList = packageManager.queryIntentActivities(mainIntent, 0);
精彩评论