我的活动有问题。 我认为问题几乎和中国一样 this post.
问题是。我还没有listView。我有一个datePicker
protected Dialog onCreateDialog(int id) {
switch (id) {
case DATE_DIALOG_ID:
// set date picker as current date
Calendar cal = Calendar.getInstance();
SimpleDateFormat year_sdf = new SimpleDateFormat("yyyy");
SimpleDateFormat month_sdf = new SimpleDateFormat("M");
SimpleDateFormat day_sdf = new SimpleDateFormat("d");
year = Integer.parseInt(year_sdf.format(cal.getTime()));
month = Integer.parseInt(month_sdf.format(cal.getTime()))-1;
day = Integer.parseInt(day_sdf.format(cal.getTime()));
return new DatePickerDialog(this, datePickerListener,
year, month,day);}
这里我有一个在datePicker上按下完成按钮时调用的函数:
private DatePickerDialog.OnDateSetListener datePickerListener
= new DatePickerDialog.OnDateSetListener() {
// when dialog box is closed, below method will be called.
public void onDateSet(DatePicker view, int selectedYear,
int selectedMonth, int selectedDay) {
Log.e("TCPClient","datePicker is there");
year = selectedYear;
month = selectedMonth+1;
day = selectedDay;
StringBuilder dateOfDelivery = new StringBuilder().append(day).append(".").append(month).append(".").append(year);}
我想在其他帖子中,datePicker想要指向一个不存在的对象。
非常感谢你。为了你的帮助。