//在点击事件中写 getTime 是点击完成是返回的时间信息 设置在TextView上
calendar = Calendar.getInstance();
dialog = new DatePickerDialog(MainActivity.this, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
getTime.setText(year + "/" + monthOfYear + "/" + dayOfMonth); }
},
calendar.get(Calendar.YEAR), calendar .get(Calendar.MONTH),
calendar .get(Calendar.DAY_OF_MONTH));dialog.show();