Closed rkarodia closed 8 years ago
I don't see why you need a OnCancelListener but since you can manually call dismiss(), you know its going to be cancelled, right? Or if the dialog closed by user pressing back button, you can catch the event and check if the dialog is showing.
@tuanna-hsp How you catch the event when Back button is pressed? Activity's onBackPressed is not fired when dialog is shown...
Yes ,There is no way to handle OnCancelled Event.Activity/Fragment not recognizing onBackpress event when Dialog is shown. there should be option like Ex. ProgressDialog myDialog = ProgressDialog.show( mContext, "Please wait...", "Loading the data", true, true, new DialogInterface.OnCancelListener(){ @Override public void onCancel(DialogInterface dialog) { Log.d(TAG,"onCancel"); objName.cancel(true); } } );
There's currently no way to set a OnCancelListener