Itβs hard for me to get the back button to actually complete my work when I click. I start a very simple video review using progressdialog to show the download dialog and onpreparedlistener, etc. Etc. Simple things. In any case, at present, when I press the "Back" button, it just cancels the progress of the dialogue, and leaves a black screen, and then presses again, the dialogue restarts! and then when I press the back button again, the video cannot play back dialog box appears. very annoying. Thank you for your help.
public class VideoActivity extends Activity { private VideoView mVideoView; private static ProgressDialog progressdialog; private String path; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.videoview); progressdialog = ProgressDialog.show(this, "", " Video Loading...", true); progressdialog.setCancelable(true); mVideoView = (VideoView) findViewById(R.id.surface_view); mVideoView.setMediaController(new MediaController(this)); Bundle b = this.getIntent().getExtras(); path = b.getString("path"); mVideoView.setVideoURI(Uri.parse(path)); mVideoView.setOnPreparedListener(new OnPreparedListener() { public void onPrepared(MediaPlayer mp) { progressdialog.dismiss(); mVideoView.requestFocus(); mVideoView.start(); } }); } @Override public void onBackPressed() {
source share