Yes, this seems like an Android bug (can't say which versions are affected).
I have the following in my DialogPreference subclass. Note the call to
clearFocus.
@Override
protected void onDialogClosed(boolean positiveResult) {
super.onDialogClosed(positiveResult);
if (positiveResult) {
mTimePickerView.clearFocus();
int hourOfDay = mTimePickerView.getCurrentHour();
int minute = mTimePickerView.getCurrentMinute();
onTimeChanged(mTimePickerView, hourOfDay, minute);
if (callChangeListener(mNewValue)) {
setValue(mNewValue);
}
}
mTimePickerView = null;
}
-- K
2012/11/7 Matthew Fleming <[email protected]>
> Hi,
>
> I'm returning to Android development after a fairly long hiatus, so please
> excuse the following question if the answer is obvious. I have a DatePicker
> in a fragment, which is being supported by the compatibility library (I'm
> trying to keep it compatible back to 2.1). The user can set the date, which
> is then read using DatePicker.getYear() etc. When the date is changed using
> the DatePicker's Spinner, the date is updated and can be read correctly.
> But when the date is changed by inputing text into the DatePicker EditText
> with the keyboard, the date is not updated, until one of the spinner's
> arrows is clicked. Is there any way around this? I suppose I could attach a
> listener to the EditText, but this would use DatePicker's undocumented
> internals, and might break down the road.
>
> Thanks very much,
>
> Matthew Fleming
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en