Java tutorial
//package com.java2s; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.net.Uri; public class Main { public static void playTrailer(Context context, String key) { Intent intent; try { intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + key)); context.startActivity(intent); } catch (ActivityNotFoundException ex) { intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=" + key)); context.startActivity(intent); } } }