I'd like to leverage the built-in intent chooser to display a custom filtered list of apps for user to select from and launch.
I know how to get a list of installed packages:
final Intent myIntent = new Intent(android.content.Intent.ACTION_MAIN);
List<ResolveInfo> resInfoList = getPackageManager().queryIntentActivities(myIntent, 0);
At this point I want to filter the list based on a specific string (or variation of strings) contained within the package name, which I can figure out how to do as well.
But here's where I get stuck. As far as I know, Intent.createChooser()
takes only a single target Intent as a parameter. I was hoping there was an overload that took a list of intents based on package and class names or something. But I don't see anything like that. Did I miss that somewhere?
So the question is, is this possible to do with a built-in chooser, or do I have to construct my own with AlertDialog Builder? I'm hoping to avoid the later.
Thanks in advance.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…