Code example for ActivityNotFoundException

0
				overrideUrlLoading = true;
			} catch (ActivityNotFoundException anfe) {
				displayAndLogIntentError(anfe);
			} 
		} else { 
			displayAndLogIntentError(new ActivityNotFoundException("YouTube intent search failed"));
		} 
 
		return overrideUrlLoading;
	} 
 
	private boolean canHandleYoutubeLinks(String url) {
		Intent urlIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
		PackageManager packageManager = activity.getPackageManager();
 
		List<ResolveInfo> list = packageManager.queryIntentActivities(urlIntent, PackageManager.MATCH_DEFAULT_ONLY);
		return !list.isEmpty();
	} 
 
	private void displayAndLogIntentError(ActivityNotFoundException anfe) {
		LogMe.e(anfe);
		LogMe.e(NO_MATCHING_INTENT);
		Toast.makeText(activity, NO_MATCHING_INTENT, Toast.LENGTH_LONG).show();
	} 
} 
Contextual code suggestions in your IDE  Get Codota for Java