Pretty simple; The dialog is showing. I press the back button on the phone, nothing happens. I’ve tried this, but it never gets called:
static void ProgressDialog(Context context)
{
String text = context.getString(R.string.dialog_loading_video);
vDialog = new ProgressDialog(context)
{
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if (keyCode == KeyEvent.KEYCODE_BACK)
{
// Nothing happening here!
}
return super.onKeyDown(keyCode, event);
}
};
vDialog = ProgressDialog.show(context, "", text);
vDialog.getWindow().setGravity(Gravity.TOP);
}
First, get rid of the second assignment to
vDialog. Then, you need to make your dialog cancelable by callingsetCancelable(boolean).