private TimePicker timePicker;
private AlertDialog ad;
private String dateTime;
private String initDateTime;
private Activity activity;
/**
-
日期时间弹出选择框构造函数
-
@param activity
-
:调用的父activity
-
@param initDateTime
-
初始日期时间值,作为弹出窗口的标题和日期时间初始值
*/
public DateTimePickDialogUtil(Activity activity, String initDateTime) {
this.activity = activity;
this.initDateTime = initDateTime;
}
public void init(DatePicker datePicker, TimePicker timePicker) {
Calendar calendar = Calendar.getInstance();
if (!(null == initDateTime || “”.equals(initDateTime))) {
calendar = this.getCalendarByInintData(initDateTime);
} else {
initDateTime = calendar.get(Calendar.YEAR) + “年”
-
calendar.get(Calendar.MONTH) + “月”
-
calendar.get(Calendar.DAY_OF_MONTH) + "日 "
-
calendar.get(Calendar.HOUR_OF_DAY) + “:”
-
calendar.get(Calendar.MINUTE);
}
datePicker.init(calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar