Created
January 4, 2016 08:32
-
-
Save Limuyang1013/e7e4f0d43206b0f794bb to your computer and use it in GitHub Desktop.
检查有没有应用程序来接受处理你发出的intent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isIntentAvailable(Context context, String action) { | |
final PackageManager packageManager = context.getPackageManager(); | |
final Intent intent = new Intent(action); | |
List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); | |
return list.size() > 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment