Elad Benda Elad Benda - 1 year ago 91
Android Question

why is setOnShowListener never called?

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)

Answer Source

I could be wrong but you should set the listener before you call show() on the Dialog.