Skip to content

Instantly share code, notes, and snippets.

@kernelhcy
Created September 5, 2013 15:37
Show Gist options
  • Save kernelhcy/6451858 to your computer and use it in GitHub Desktop.
Save kernelhcy/6451858 to your computer and use it in GitHub Desktop.
检查一个Intent是否能被处理。
public boolean isIntentExisting(Context context, String action) {
final PackageManager packageManager = context.getPackageManager();
final Intent intent = new Intent(action);
List<ResolveInfo> resolveInfo =
packageManager.queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
if (resolveInfo.size() > 0) {
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment