so I'm building a launcher and I need a way of saving Intents. I am using the following code to get a list of installed applications where the user can select which to run.
Code -
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List pkgAppsList = getActivity().getPackageManager().queryIntentActivities( mainIntent, 0);
startActivity(Intent.createChooser(mainIntent, "Choose your default app"));
But I have several buttons, and I'm using this method to let the user choose which application to run. But the problem is I would like these selections made by the user to be saved, for example, when I click the clock button it lets me choose which app I want to run, then it's saved. But I don't know how.
Also I did find a way to do it, I just removed "Intent.createChooser();
" so that I can select "use default" but when you set it as default, any other button you press such as the calendar button, it opens the clock button.
I have done lots of research on intents and have gotten all this working but I'm finding it hard to do that above, please if you know a way of making an App Chooser, where the user gets to select which app to launch when a button is pressed and then that intent gets saved so the user doesn't have to keep choosing.
Thanks for your time, hopefully I've asked everything in good manner.