Android Time Control modified birthday

Source: Internet
Author: User

Private class Textview_persinal_birth_onclick implements View.onclicklistener {
@Override
public void OnClick (View v) {
Datepickerdialog.ondatesetlistener datesetlistener=new Datepickerdialog.ondatesetlistener () {
@Override
public void Ondateset (DatePicker view, int year, int monthofyear, int dayofmonth) {
Calendar.set (calendar.year,year);
Calendar.set (calendar.month,monthofyear);
Calendar.set (Calendar.day_of_month,dayofmonth);
try {
Date Date_input=simpledateformat.parse (Simpledateformat.format (Calendar.gettime ()));
Date Date_system=simpledateformat.parse (Simpledateformat.format (Calendar.getinstance (). GetTime ()));
Long Inputtime=date_input.gettime ();
Long Systemtime=date_system.gettime ();
if (inputtime<=systemtime) {
Birth=simpledateformat.format (Calendar.gettime ());
Textview_persional_birth.settext (birth);
}
Else
Toast.maketext (personalinformationactivity.this, "birthdays cannot be greater than the current date! ", 1). Show ();

} catch (ParseException e) {
E.printstacktrace ();
}


}
};
New Datepickerdialog (Personalinformationactivity.this,
Datesetlistener,
Calendar.get (Calendar.year),
Calendar.get (Calendar.month),
Calendar.get (Calendar.day_of_month)). Show ();
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.