when my dialog fragment is hide
, dispatchKeyEvent
worked fine
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
Toast.makeText(FragmentPlayer.this, "test: called", Toast.LENGTH_SHORT).show();
return super.dispatchKeyEvent(event);
}
but when my dialog fragment is show
, dispatchKeyEvent
not called
MyDialogFragment mFragment = new MyDialogFragment();
mFragment.show(getSupportFragmentManager(), "MyDialog");
why?
... extends Dialog
. not usedialog fragment
. SimpleDialog
classdispatchKeyEvent
fix and is ok. when dialog fragment is show, dispatchKeyEvent not working. so you should useDialog
class – Notification