bt2.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
if (cd!=null)cd=null;
cd =Calendar.getInstance();
DatePickerDialog datePickerDialog = new DatePickerDialog(MainActivity.this, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
cd.set(Calendar.YEAR,year);
cd.set(Calendar.MONTH,month);
cd.set(Calendar.DAY_OF_MONTH,dayOfMonth);
}
}, cd.get(Calendar.YEAR), cd.get(Calendar.MONTH), cd.get(Calendar.DAY_OF_MONTH));
datePickerDialog.show();
}
});
安卓原生的日期选择器