當前我正在使用下面的代碼,並且可以獲取當前日期以在文本字段中顯示。不過,我不知道如何顯示選定的日期。如何從CalendarView中提取日期並顯示選定的日期?
我也使用DatePicker,它顯示精選的日期,但我更喜歡CalendarView。由於
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(R.id.textfield1);
editText.setText(currentdate);
你的問題不明確。你想要什麼? – Snicolas 2012-04-26 19:17:57
如果用戶在CalendarView上選擇日期,我想將它存儲在變量中,並將其顯示在下一個活動中,那麼用戶可以得到您選擇的日期消息25-04-2012 – GuyWhoReadsStockoverflow 2012-04-26 19:19:41
當您調用下一個活動時將它傳遞到意圖的額外。否則,請學習如何使用startActivityForResult – Snicolas 2012-04-26 19:22:29