Android youtube 播放器 activity 在 oncreateoptionsmenu 中使用
Android youtube player activity inside oncreateoptionsmenu using
我使用 YouTube 视频的视频视图,但 OnCreateOptionsMenu
不是 运行。如何使用未使用的youtubeplayerfragment?里面的YouTubeBaseActivity是否支持使用?
这个videoactivity.class
public class videoactivity extends YouTubeBaseActivity{
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean loadAgain) {
if (!loadAgain) {
youTubePlayer.cueVideo(ID_VIDEO);
}
}
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
}
}
和OnCreateOptionsMenu
方法:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.video_menu, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
super.onOptionsItemSelected(item);
this.finish();
goBackWithAnimation();
break;
case R.id.share_button:
showShareOptions();
break;
}
return true;
}
但不是 运行。如何使用?
我使用 YouTube 视频的视频视图,但 OnCreateOptionsMenu
不是 运行。如何使用未使用的youtubeplayerfragment?里面的YouTubeBaseActivity是否支持使用?
这个videoactivity.class
public class videoactivity extends YouTubeBaseActivity{
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean loadAgain) {
if (!loadAgain) {
youTubePlayer.cueVideo(ID_VIDEO);
}
}
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
}
}
和OnCreateOptionsMenu
方法:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.video_menu, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
super.onOptionsItemSelected(item);
this.finish();
goBackWithAnimation();
break;
case R.id.share_button:
showShareOptions();
break;
}
return true;
}
但不是 运行。如何使用?