How to display date picker dialog box extends from linear layout view in android -
i making custom view extend linear layout. here want display date picker when click getdate button. how this?
public class xmltest extends linearlayout implements onitemselectedlistener, ondatesetlistener{ date = calendar.getinstance(); btndate.setonclicklistener(new button.onclicklistener() { @override public void onclick(view v) { datepickerinput=v.getid(); (int d = 0; d < mlistdatetimebutton.size(); d++){ if (listdatetimebutton.get(d).getid() == v.getid()){ showdatedialog(etlocationtest, date); } } } }); } protected void showdatedialog(edittext etlocationtest2, calendar date2) { log.i("", "date showdatedialog "); activedatedisplay = etlocationtest2; activedate = date2; ((activity) getcontext()).showdialog(date_dialog_id); }
but not display date picker dialog box. how this.
inside oncreateview. btndate.setonclicklistener(new view.onclicklistener() {
public void onclick(view v) { datepickerdialog dialog = new datepickerdialog(getactivity(),datepickerlistener, year, mon,day); dialog.show(); } });
private datepickerdialog.ondatesetlistener datepickerlistener = new datepickerdialog.ondatesetlistener() {
public void ondateset(datepicker view, int selectedyear, int selectedmonth, int selectedday) { //do whatever want selectedday,selectedmonth , selectedyear } };
Comments
Post a Comment