Try using DatePicker...
here is the sample code..
Write this in your activity class..
static final int DATE_DIALOG_ID = 0;
@Override
protected Dialog onCreateDialog(int id) {
Calendar c = Calendar.getInstance();
int cyear = c.get(Calendar.YEAR);
int cmonth = c.get(Calendar.MONTH);
int cday = c.get(Calendar.DAY_OF_MONTH);
switch (id) {
case DATE_DIALOG_ID:
return new DatePickerDialog(this, mDateSetListener, cyear, cmonth,
cday);
}
return null;
}
private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() {
// onDateSet method
public void onDateSet(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
String date_selected = String.valueOf(dayOfMonth) + " - "
+ String.valueOf(monthOfYear + 1) + " - "
+ String.valueOf(year);
Toast.makeText(getApplicationContext(), "Selected Date is =" + date_selected, Toast.LENGTH_SHORT).show();
}
};
and call this whenever you want to display the Datepicker..
showDialog(DATE_DIALOG_ID);
That displays a nice DatePicker from which you can select a date....