Here is my code:
mDialog.show();
mDialog.setOnShowListener(new OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
//some code
}
});
The breakpoints shows that //some code
is never called. Can you help me understand what is happening ?
It's API 8 and above (supported by my app)
I could be wrong but you should set the listener before you call show()
on the Dialog.
Try this:
mDialog.setOnShowListener(new OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
//some code
}
});
mDialog.show();
This way you ensure that the listener is registered before the dialog is shown.
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