Hello
In my android application i am playing videos using video view.While the video is getting downloaded i am showing a progress dialogue. At times when the streaming is not supported or when there is some error an error message is displayed onto the screen.After the ok click of the error message the progress dialogue again shows the message and tries to download. But i would like to dismiss this dialogue if there is any error messgae and as soon as the user clicks Ok and return to the video player so that the user can go through the next or previous video.
private ProgressDialog mProgressDialog; Handler myUiHandler = new Handler(); boolean m_prgisShowing = false; private static final int DIALOG_100 = 0; ProgressDialog mDialog2;
mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { public void onPrepared(MediaPlayer mp) { Log.i("Manju", "OnPrepared"); myUiHandler.post(myDilgDismis); mVideoView.start();
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_100: {
mDialog2 = new ProgressDialog(this);
mDialog2.setMessage("buffering...");
mDialog2.setIndeterminate(true);
mDialog2.setCancelable(true);
return mDialog2;
}
}
return null;
}
Runnable myDilgShow = new Runnable() {
public void run() {
show_My_Dialog();
}
};
Runnable myDilgDismis = new Runnable() {
public void run() {
dismiss_My_Dialog();
}
};
public void show_My_Dialog() {
m_prgisShowing = true;
showDialog(DIALOG_100);
}
public void dismiss_My_Dialog() {
if (m_prgisShowing) {
try {
if (null != mDialog2) {
mDialog2.dismiss();
}
} catch (Exception e) {
e.printStackTrace();
m_prgisShowing = false;
}
}
m_prgisShowing = false;
}
Please share your valuable suggestions.
Thanks in advance:)