Monday, May 21, 2012

How to catch touch event of an dialog when it is clicked outside

Actually 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 do 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 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





No comments:

Post a Comment