Reputation: 23510
I have a DatePicker which I follow changes with
dp.init(dp.getYear(), dp.getMonth(), dp.getDayOfMonth(), new OnDateChangedListener() {
public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
...
}
But I don't find any way to find the before / after values.
I would like to increment a second date (date 2) by the kind of increment done on date 1. If the user change the days, i'd like to add days to the second date, if years, I'd like to add years. Do you see a way to do this ?
After all, I would also like to forbid some values, and be able to bring back the date1 to its original value (those before the change). Any idea for this ?
I'm searching but I don't find anything that would allow me to do those two things.
Any help would be greatly appreciated.
Thank you.
Oliver
Upvotes: 2
Views: 7126
Reputation: 5999
Check this link for example code help..
http://android-pro.blogspot.com/2010/04/android-date-and-time-controls.html
and
Custom DatePicker as Preference does not keep value when user edits value in field
Upvotes: 3