I asked a similar question this week. I still don't understand. How do you get all the applications installed on your device? Can I get it? And how do you do what you choose?
Intent intent = new Intent(ACTION_MAIN);
intent.addCategory(CATEGORY_LAUNCHER);
I tried it like this, but I only saw the basic app.
I know I can get a list of installed apps from Package Manager, but how do I run it?
android android-intent
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List pkgAppsList = context.getPackageManager().queryIntentActivities( mainIntent, 0)
This way, you can get a list of applications. And if you want to run an application, After you know the name of the package you want to run,
Intent intent = context.getPackageManager().getLaunchIntentForPackage("ParkageName");
startActivity(intent);
You can run the activity this way.
© 2024 OneMinuteCode. All rights reserved.