-1
I got it inside the onCreate
:
final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
// TODO Auto-generated method stub
myCalendar.set(Calendar.YEAR, year);
myCalendar.set(Calendar.MONTH, monthOfYear);
myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
updateLabel(myCalendar);
}
};
editText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
new DatePickerDialog(AgendamentoActivity.this, date, myCalendar
.get(Calendar.YEAR), myCalendar.get(Calendar.MONTH),
myCalendar.get(Calendar.DAY_OF_MONTH)).show();
}
});
And that out:
private void updateLabel(Calendar myCalendar) {
String dia = myCalendar.toString();
Log.d("TAG", "DATA " + dia);
}
How do I pick the selected date from within the day variable?
You want the full date (Date object) or the day?
– André Ozawa
I would like dd/mm/YYYY
– GustavoSevero