I developed a similar canvas once. The layout may be what you imagine. follows the methods I did to call the android calendar and capture the date selected by the user in an edit.
edt_data = (EditText)findViewById(R.id.edt_data);
bCalendario= (Button)findViewById(R.id.b_calendario);
bCalendario.setOnClickListener(new View.OnClickListener() {
@SuppressWarnings("deprecation")
public void onClick(View v) {
showDialog(DATE_DIALOG_ID); //chamar o calendario
}
});
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case DATE_DIALOG_ID: return new DatePickerDialog(this, mDateSetListener,mYear, mMonth-1, mDay);
}
return null;
}
private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
mYear = year;
mMonth = monthOfYear;
mDay = dayOfMonth;
updateDisplay();
}
};
private void updateDisplay() {
edt_data.setText(new StringBuilder()
// Month is 0 based so add 1
.append(mDay).append("/")
.append(mMonth + 1).append("/")
.append(mYear).append(" "));
}