カスタム ダイアログ内に VideoView があります。ダイアログが初めて表示されたとき、ビデオは正しく再生されますが、ダイアログを閉じてから再度ロードすると、ビデオは再生されず、ダイアログは単なる黒い画面になります。
Dialog を作成するために使用するコードは次のとおりです。
Dialog d;
protected Dialog onCreateDialog(int id) {
switch(id) {
case DIALOG_VIDEO:
AlertDialog.Builder builder;
LayoutInflater inflater = (LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.video,null);
final VideoView vv = (VideoView)layout.findViewById(R.id.vv);
vv.setMediaController(new MediaController(this));
vv.setVideoURI(path);
vv.setZOrderOnTop(true);
vv.requestFocus();
vv.start();
builder = new AlertDialog.Builder(this);
builder.setView(layout);
d = builder.create();
d.setOnDismissListener(new DialogInterface.OnDismissListener() {
public void onDismiss(DialogInterface dialog) {
VideoView vv = (VideoView)d.findViewById(R.id.vv);
vv.stopPlayback();
vv.clearFocus();
}
});
break;
default:
d = null;
}
return d;
}
私は何を間違っていますか?
お時間をいただきありがとうございます。下手な英語で申し訳ありません。