Android datepicker ondateSetListener executed twice -


every time code launch callback, date picked (and inserted in database) twice.

of course don't need beahviour. note error in bluestack emulator (android 4.3), galaxy ace rooted cyanogenmod 4.4 not in samsung s3 (android 4.3)

thank you

private void setfab(){         // button         floatingactionbutton neweventbutton = (floatingactionbutton) v.findviewbyid(r.id.set_new_event);         neweventbutton.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view v) {                 calendar c = calendar.getinstance();                 int myear = c.get(calendar.year);                 int mmonth = c.get(calendar.month);                 int mday = c.get(calendar.day_of_month);                  datepickerdialog dialog = new datepickerdialog(getactivity(), datepickerlistener, myear, mmonth, mday);                  /*dialog.setbutton(datepickerdialog.button_positive, "ok", dialog);                 dialog.setbutton(dialoginterface.button_positive,"ok",dialog.ondatechanged(datepicker view););*/                 dialog.show();             }         });     }  private datepickerdialog.ondatesetlistener datepickerlistener             = new datepickerdialog.ondatesetlistener() {          // when dialog box closed, below method called.         public void ondateset(datepicker view, int selectedyear,                               int selectedmonth, int selectedday) {              string stringyear = integer.tostring(selectedyear);              selectedmonth = selectedmonth+1;              string stringmonth = integer.tostring(selectedmonth);              if (stringmonth.length()==1){                 stringmonth = "0"+stringmonth;             }              string stringday = integer.tostring(selectedday);              if (stringday.length()==1){                 stringday = "0"+stringday;             }              string date = stringyear+"-"+stringmonth+"-"+stringday+" 00:00:00";             setevent(date);             //last_event = getlastevent();             setdashboard();          }     }; 


Comments

Popular posts from this blog

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

c# - Specify IP End Point in FiddlerCore -

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -