If the user clicks on a button, I set myVar = true, then show a date picker dialog. In the date set listener, onDateSet, I check to see if myVar = true. If so, I do a little extra then set myVar = false.
Problem is, if somebody clicks the button then doesn’t continue to set a date. They click back or they click cancel… myVar still = true. If they fail to change the date, I need myVar = false. What’s the best way to go about this?
Why not just create a second variable like boolean cancelled = false; Set it to true when a date is selected.