Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kyze8439690
Created October 14, 2015 06:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyze8439690/45835708ea1a1fb275f8 to your computer and use it in GitHub Desktop.
Save kyze8439690/45835708ea1a1fb275f8 to your computer and use it in GitHub Desktop.
FilterIntentChooser
Intent[] targetedShareIntents = new Intent[infos.size()];
for (int i = 0; i < infos.size(); i++) {
String packageName = infos.get(i).activityInfo.packageName;
Intent targetedShareIntent = new Intent(Intent.ACTION_VIEW, uri);
targetedShareIntent.setPackage(packageName);
targetedShareIntents[i] = targetedShareIntent;
}
Intent chooserIntent = Intent.createChooser(new Intent(), "打开网页");
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents);
activity.startActivity(chooserIntent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment