如何避免重新加载的方向更改视频,例如强制视频从中恢复。
我试过下面但是它失败了
vd = (VideoView) findViewById(R.id.vplayer);
.......
public void onSaveInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
savedInstanceState.putInt("Position",vd.getCurrentPosition());
}
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
int position= savedInstanceState.getInt("Position");
vd.seekTo(position);
}
答案 0 :(得分:7)
您可以执行的操作是停止在方向更改时重新创建活动。您可以通过添加AndroidManifest.xml
activity tag
文件来实现
android:configChanges="keyboardHidden|orientation"