After setting:
MyDialogFragment fragment = new MyDialogFragment();
fragment .setCancelable(false);
it is still dismissed after click on search button. and i haven't found option like in activity to override onKeyDown();
I need create dialog that will be shown until my "dismiss" button is pressed.Please Help
I've just found an answer. After DialogFragment was created we can get the its dialog
Dialog dialog = getDialog();
if( null!= dialog)
{
dialog.setOnKeyListener(new OnKeyListener()
{
@Override
public boolean onKey ( DialogInterface dialog , int keyCode , KeyEvent event )
{
// disable search button action
if (keyCode == KeyEvent.KEYCODE_SEARCH)
{
return true;
}
return false;
}
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With