android - DatePicker and TimePicker code not working together ("protected Dialog onCreateDialog(int id)" is already defined) -
i have created app, in have datepicker , timepicker. first made datepicker , displayed when selected date textview, worked fine. wanted same time edittext instead of displaying datepicker supposed display timepicker when selected.
after implemented code timepicker: error "protected dialog oncreatedialog(int id)" defined , cannot use method twice.
any appreciated,
thanks in advance
i assume have 1 dialogfragment both date , time pickers... create conflict have implemented oncreatedialog.
what create class each component have different implementation of oncreatedialog.
public class datepickerdialog extends dialogfragment implements datepickerdialog.ondatesetlistener{ @override public dialog oncreatedialog(bundle savedinstancestate) { ... } public class timepickerdialog extends dialogfragment implements timepickerdialog.ontimesetlistener{ @override public dialog oncreatedialog(bundle savedinstancestate) { ... }
then call in activity ...
datepickerdialog dialog = new datepickerdialog(); fragmentmanager fm = getsupportfragmentmanager(); dialog.show(fm, "date picker");
this way add custom callbacks or listeners each picker , use them multiple times in 1 activity.
Comments
Post a Comment