GuyWhoReadsStockoverflow GuyWhoReadsStockoverflow - 1 year ago 83
Android Question

How can I extract date from CalendarView and display selected date?

Currently I am using code below and I can get current date to be dispalyed in Text field. However I have no idea how to display selected date.

I also used DatePicker and it displays selected date fine, however I would prefer CalendarView. Thanks

Calendar c = Calendar.getInstance();
SimpleDateFormat ss = new SimpleDateFormat("dd-MM-yyyy");
Date date = new Date();
String currentdate= ss.format(date);
TextView editText = (TextView) this.findViewById(;


in onCreate :

 CalendarView v = new CalendarView( this );
 v.setOnDateChangeListener( new CalendarView.OnDateChangeListener() {
    public void onSelectedDayChange(CalendarView view, int year, int month, int dayOfMonth) {
       this.calendar = new GregorianCalendar( year, month, dayOfMonth );