时间选择器工具类

/**
 * 时间选择器工具类
 * 依赖库:com.contrarywind:Android-PickerView:4.1.9
 * 调用:new TimePickerUtil(TimePickerUtil.TIMETYPE.SECOND, AddTaskActivity.this) {
*            @Override
*            public void setFormatTime(String formattime) {
*
*            }
*       };
 */
public abstract class TimePickerUtil {

    private TIMETYPE timetype;
    private Activity activity;

    public enum TIMETYPE {
        SECOND, MINUTE, DAY
    }

    public TimePickerUtil(TIMETYPE timetype, Activity activity) {
        this.timetype = timetype;
        this.activity = activity;
    }

    public void getTimeWithType() {
        TimePickerView pvTime = new TimePickerBuilder(activity, new OnTimeSelectListener() {
            @Override
            public void onTimeSelect(Date date, View v) {
                String formattime = "";
                if(timetype.equals(TIMETYPE.SECOND)){
                    formattime  =DateUtils.date2String(date, DateUtils.YYYYMMDDHHMMSS_FORMAT);
                }else if

你可能感兴趣的:(Android)