Created
September 5, 2013 15:37
-
-
Save kernelhcy/6451858 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 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