Elad Benda Elad Benda - 2 months ago 12
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

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

Comments