Is there a way to check and see if an Activity exists on your device? If I have a youtube video link I want to specify it open in the YouTube PlayerActivity. However, I don\
Here's how I check if an Activity is available on the device:
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tell//:" + phoneNumber));
PackageManager manager = context.getPackageManager();
List activities = manager.queryIntentActivities(
intent, 0);
if (!manager.hasSystemFeature(
PackageManager.FEATURE_TELEPHONY) || activities == null || activities
.size() < 1) {
Toast.makeText(
context,
"Sorry, there were no apps that worked with that request.",
Toast.LENGTH_SHORT).show();
} else {
context.startActivity(intent);
}