public class PlayerTest extends YouTubeBaseActivity implements YouTubePlayer.OnInitializedListener { YouTubePlayerView youTubeView = (YouTubePlayerView) findViewById(R.id.youtube_view); youTubeView.initialize(DEVELOPER_KEY, this); @Override public void onInitializationFailure(Provider provider, YouTubeInitializationResult error) { Toast.makeText(this, "Error :( " + error.toString(), Toast.LENGTH_LONG) .show(); } @Override public void onInitializationSuccess(Provider provider, YouTubePlayer player, boolean wasRestored) { player.cueVideo(video); }