I have Dialog
in my activity, what I want is suppose the dialog is open, then on Touch of outside dialog I want to dismiss the dialog, and at the same time, I want to call a function which does some update in my activity.
Initially I used MyDialog.setCanceledOnTouchOutside(true);
But these will only dismiss and in my case, at the same time I want to call some functions whenever user click outside of a dialog. So what should I do? I know that if I can extend the Dialog
class and override its onTouchEvent
method then it will be solved but in my case, my class already extends Activity class and in java, we can't extend more then one class.
So what will be the best solution for that? Please help me to solve this out.
The second answer on this thread shows how to do this (used it myself, works):
How to cancel an Dialog themed like Activity when touched outside the window?
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