I want to call a method when the user select a date on a datepicker
. I don't know how to do that, there is no onDateSet
method. Should I use a listener
? Please help me.
EDIT: Here's the code regarding the datepicker:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
dp=(DatePicker)findViewById(R.id.dp);
c = Calendar.getInstance();
Month =c.get(Calendar.MONTH)+1;
Day = c.get(Calendar.DAY_OF_MONTH);
Year = c.get(Calendar.YEAR);
dp.init(c.get(Calendar.YEAR),(c.get(Calendar.MONTH)+1), Day, null);
Now, this view is in the main layout of my app, it have no buttons, just the datepicker with rolling number. I want to call a method when the user roll a different number on this datepicker. There is no positive button or any button at all, so the answer wouldn't work for me...