Android two times call Datepickerdialog.ondateset ()

Source: Internet
Author: User

Call the system's Datepickerdialog on the 4.2.2 version, and find that the system calls Ondateset () two times when the click is OK, and it needs to be filtered one time.


Calendar Mcalendar = Calendar.getinstance (); Mcalendar.add (calendar.day_of_year, 1); final Datepickerdialog DateDialog = New Datepickerdialog (This, new Datepickerdialog.ondatesetlistener () {    Boolean mfired = false;    public void Ondateset (final DatePicker view, final int year, final int monthofyear, final int dayofmonth) {        log.i ("PEW PEW "," Double Fire Check ");        if (mfired = = True) {            log.i ("Pew Pew", "Double fire occured". Silently-ish returning ");            return;        } else {            //first time mfired            mfired = true;        }        Normal Date picking logic goes here}    }, Mcalendar.get (Calendar.year), Mcalendar.get (Calendar.month), Mcalendar.get (calendar.day_of_month));d atedialog.show ();



References: https://code.google.com/p/android/issues/detail?id=64895

Android two times call Datepickerdialog.ondateset ()

Related Article

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.