我有一个活动,其中包含一个VideoView和一个共享按钮。点击分享按钮,它会调用邮件客户端。这是我的代码:
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.phrasevideo);
//extraDataHelper.getPhraseDetails(phraseId);
btnshare = (ImageView) findViewById(R.id.btnshare);
videoView = (VideoView) findViewById(R.id.VideoView);
File f=new File(Environment.getExternalStorageDirectory(), "extras/hello.mp4");
Uri video = Uri.parse(f.getAbsolutePath());
videoView.setVideoURI(video);
btnshare.setVisibility(View.VISIBLE);
}});
videoView.start();
btnshare.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
// TODO Auto-generated method stub
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/html");
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{""});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Language Hostess");
String emailText = "<html><body><p>Hi friends</p></body></html>";
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(emailText));
startActivityForResult(Intent.createChooser(emailIntent, "Email:"), 1);
return false;
}});
}
一切都很好。但是当我在发送或丢弃邮件后回到应用程序时,videoView只是黑色。在这里,我想提一下,只有在视频没有播放时才会出现分享按钮。为什么会这样?这个问题的解决方案是什么?
答案 0 :(得分:0)