当前我正在使用下面的代码,并且可以获取当前日期以在文本字段中显示。不过,我不知道如何显示选定的日期。如何从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