android - Need to stop the date picker copying into the 2 textviews -
i have 2 imagebuttons , 2 textviews. following code writes same date 2 textviews dont want, when click 1 image button meant write edittext1 , when second clicked should write edittext2
here code
public void selectdate(view view) { dialogfragment newfragment = new selectdatefragment(); newfragment.show(getsupportfragmentmanager(), "datepicker"); } public void populatesetdate(int year, int month, int day) { departdate = (textview)findviewbyid(r.id.edittext1); departdate.settext(month+"/"+day+"/"+year); } public void populatesetdate1(int year1, int month1, int day1) { returndate = (textview)findviewbyid(r.id.edittext2); returndate.settext(month1+"/"+day1+"/"+year1); } public class selectdatefragment extends dialogfragment implements datepickerdialog.ondatesetlistener { @override public dialog oncreatedialog(bundle savedinstancestate) { final calendar calendar = calendar.getinstance(); int yy = calendar.get(calendar.year); int mm = calendar.get(calendar.month); int dd = calendar.get(calendar.day_of_month); return new datepickerdialog(getactivity(), this, yy, mm, dd); } public void ondateset(datepicker view, int yy, int mm, int dd) { populatesetdate(yy, mm+1, dd); populatesetdate1(yy, mm+1, dd); }
public void selectdate(view view) { dialogfragment newfragment = new selectdatefragment(view); newfragment.show(getsupportfragmentmanager(), "datepicker"); } public void populatesetdate(int year, int month, int day, view v) { departdate = v; departdate.settext(month+"/"+day+"/"+year); } public class selectdatefragment extends dialogfragment implements datepickerdialog.ondatesetlistener { private view view; public selectdatefragment(view view) { this.view = view; } @override public dialog oncreatedialog(bundle savedinstancestate) { final calendar calendar = calendar.getinstance(); int yy = calendar.get(calendar.year); int mm = calendar.get(calendar.month); int dd = calendar.get(calendar.day_of_month); return new datepickerdialog(getactivity(), this, yy, mm, dd); } public void ondateset(datepicker view, int yy, int mm, int dd) { populatesetdate(yy, mm+1, dd); populatesetdate1(yy, mm+1, dd); }