/DateTimePicker/src/com/wwj/datetimepicker/DateTimePickDialogUtil.java
package com.wwj.datetimepicker;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.widget.DatePicker;
import android.widget.DatePicker.OnDateChangedListener;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TimePicker;
import android.widget.TimePicker.OnTimeChangedListener;
/**
-
日期时间选择控件 使用方法: private EditText inputDate;//需要设置的日期时间文本编辑框 private String
-
initDateTime=“2012年9月3日 14:44”,//初始日期时间值 在点击事件中使用:
-
inputDate.setOnClickListener(new OnClickListener() {
-
@Override public void onClick(View v) { DateTimePickDialogUtil
-
dateTimePicKDialog=new
-
DateTimePickDialogUtil(SinvestigateActivity.this,initDateTime);
-
dateTimePicKDialog.dateTimePicKDialog(inputDate);
-
} });
-
@author
*/
public class DateTimePickDialogUtil implements OnDateChangedListener,
OnTimeChangedListener {
private DatePicker datePicker;
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;