Like the title says, what is the difference between a dialog being dismissed or canceled in Android?
dismiss
is something you have to explicitly call in your code, usually to respond to a click event on a button in your Dialog
. If you prefer, you can call dismissDialog
in the Activity
, which will in turn call dismiss
on the Dialog
.
The cancel
method only executes when it is explicitly called in your code, or when the user presses the BACK button when your cancelable Dialog
is open (as @Lee noted).
If you are using a DatePicker
, then all of this is still the case. As @Lee said, DatePickerDialog.OnDateSetListener
just detects when the user has chosen a date from the DatePicker
.
The Android Developer Reference provides more info on Dialog
s.