I want to open my YouTube channel link in YouTube Android app, if YouTube app is installed on the device.
If YouTube app is not installed, then show available browser to open the link.
I found below code for facebook, But I want to implemnet similar functionality for YouTube.
ImageView ifb = (ImageView) findViewById(R.id.fb);
ifb.setOnClickListener(new View.OnClickListener() {
public void onClick(View paramAnonymousView) {
try {
Intent localIntent = new Intent(
"android.intent.action.VIEW", Uri
.parse("fb://profile/987987646432132"));
SettingsActivity.this.startActivity(localIntent);
return;
} catch (Exception localException) {
SettingsActivity.this.startActivity(new Intent(
"android.intent.action.VIEW",
Uri.parse("http://www.facebook.com/myfacebookpageurl")));
}
}
});