zoukankan      html  css  js  c++  java
  • android 两次调用DatePickerDialog.onDateSet()

    在4.2.2版本号上调用系统的DatePickerDialog。发现点击确定时系统调用onDateSet()两次。须要过滤当中的一次。


    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));
    dateDialog.show();



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

  • 相关阅读:
    mac 安装Windows系统
    各种镜像源
    应用官方下载地址汇总
    centos7 升级openssh
    ubuntu16.04升级openssh
    腾讯云
    msdeploy 远程发布到lls
    Java Script 什么是闭包?
    JavaScript我的怀疑
    HTML 之 js是干什么的
  • 原文地址:https://www.cnblogs.com/brucemengbm/p/6785566.html
Copyright © 2011-2022 走看看