Java 类android.app.DatePickerDialog.OnDateSetListener 实例源码

项目:easy-a    文件:DatePickerDialogFragment.java   
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    // Find the TaskEditFragment that created this dialog by name.
    // We'll use that fragment as the edit callback,
    // so that when the user chooses a new date in our datepicker
    // dialog, the dialog will call back into the edit fragment to
    // set the new date.
    OnDateSetListener callback = (OnDateSetListener)
            getFragmentManager()
                    .findFragmentByTag
                            (TaskEditFragment
                                    .DEFAULT_FRAGMENT_TAG);

    // Construct a new DatePicker dialog that will be hosted by
    // this fragment. Set its Year, Month, and Day to the values
    // specified in the args bundle
    Bundle args = getArguments();
    return new DatePickerDialog(getActivity(), callback,
            args.getInt(YEAR),
            args.getInt(MONTH),
            args.getInt(DAY));
}
项目:AndroidDemos    文件:MainActivity.java   
private void setBtn_chaxunClickListener(View view) {
    DatePickerDialog dpd = new MyPickerDialog(MainActivity.this,
            new OnDateSetListener() {

                @Override
                public void onDateSet(DatePicker arg0, int year, int month,
                        int day) {
                    String data = year + "年" + (month + 1) + "月";
                    tv_curYearMonth.setText(data);

                    list = aDao.selectByData(data);
                    setAdapter();
                    jisuan();
                }
            }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
            calendar.get(Calendar.DAY_OF_MONTH));
    dpd.show();

}
项目:android-app-common-tasks    文件:Common.java   
/**
 * use to show datepicker
 *
 * @param mContext
 * @param format    of the date format
 * @param mTextView in which you have to set selected date
 */
public static void showDatePickerDialog(final Context mContext,
                                        final String format, final TextView mTextView) {
    new DatePickerDialog(mContext, new OnDateSetListener() {

        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear,
                              int dayOfMonth) {
            SimpleDateFormat dateFormatter = new SimpleDateFormat(format);
            dateTime.set(year, monthOfYear, dayOfMonth);

            mTextView.setText(dateFormatter.format(dateTime.getTime()));
        }
    }, dateTime.get(Calendar.YEAR), dateTime.get(Calendar.MONTH),
            dateTime.get(Calendar.DAY_OF_MONTH)).show();
}
项目:android-app-common-tasks    文件:Common.java   
/**
 * use to show datepicker
 *
 * @param mContext
 * @param format    of the date format
 * @param mTextView in which you have to set selected date
 */
public static void showDatePickerDialog(final Context mContext,
                                        final String format, final TextView mTextView) {
    new DatePickerDialog(mContext, new OnDateSetListener() {

        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear,
                              int dayOfMonth) {
            SimpleDateFormat dateFormatter = new SimpleDateFormat(format);
            dateTime.set(year, monthOfYear, dayOfMonth);

            mTextView.setText(dateFormatter.format(dateTime.getTime()));
        }
    }, dateTime.get(Calendar.YEAR), dateTime.get(Calendar.MONTH),
            dateTime.get(Calendar.DAY_OF_MONTH)).show();
}
项目:order_dish    文件:ManagerCountActivity.java   
/**
 * �������� : getEndDate �������� : ����������ֵ˵����
 * 
 * @param etEndDate2
 *
 *            �޸ļ�¼�� ���� ��2015��10��30�� ����5:48:49 �޸��ˣ�hxf ���� ��
 * 
 */
protected void getEndDate() {
    // TODO Auto-generated method stub
    new DatePickerDialog(ManagerCountActivity.this, new OnDateSetListener() {

        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            String month = String.valueOf(monthOfYear + 1);
            String day = String.valueOf(dayOfMonth);

            if (dayOfMonth >= 1 && dayOfMonth <= 9) {
                day = "0" + day;
            }
            if (monthOfYear >= 0 && monthOfYear <= 8) {
                month = "0" + month;
            }
            etEndDate.setText(year + "-" + month + "-" + day);

        }
    }, year, monthOfYear, dayOfMonth).show();
}
项目:order_dish    文件:ManagerCountActivity.java   
/**
 * �������� : getBeginDate �������� : ����������ֵ˵����
 * 
 * @param etBeginDate2
 *
 *            �޸ļ�¼�� ���� ��2015��10��30�� ����5:48:49 �޸��ˣ�hxf ���� ��
 * 
 */
protected void getBeginDate() {
    // TODO Auto-generated method stub
    // ʹ��DatePickerDialog�Ի�������ʹ�������ڲ��෽ʽ����һ�����ڶԻ���
    new DatePickerDialog(ManagerCountActivity.this, new OnDateSetListener() {

        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {

            String month = String.valueOf(monthOfYear + 1);
            String day = String.valueOf(dayOfMonth);

            if (dayOfMonth >= 1 && dayOfMonth <= 9) {
                day = "0" + day;
            }
            if (monthOfYear >= 0 && monthOfYear <= 8) {
                month = "0" + month;
            }
            etBeginDate.setText(year + "-" + month + "-" + day);

        }
    }, year, monthOfYear, dayOfMonth).show();// ���������������ڶԻ����ʼ��ʱ���õ�ʱ�䣬���һ��Ҫ����show��������
}
项目:ClubHelperAndroid    文件:PersonListFragment.java   
private OnDateSetListener createDateSetListener() {

    OnDateSetListener listener = new OnDateSetListener() {

        @Override
        public void onDateSet(DatePicker view, final int year, final int monthOfYear, final int dayOfMonth) {
            final FragmentActivity act = getActivity();
            if(!isDetached() && !isRemoving() && act != null) {
                act.runOnUiThread(new Runnable() {

                    DateFormat df = new SimpleDateFormat("cc, dd.MM.yyyy", Locale.GERMANY);

                    @Override
                    public void run() {
                        controller.setDate(year, monthOfYear, dayOfMonth);

                        String title = act.getString(R.string.title_activity_attendance) + " " + df.format(controller.getAttendanceDate().getTime());
                        txtTitle.setText(title);
                        refreshList();
                    }
                });
            }
        }
    };
    return listener ;
}
项目:yiim_v2    文件:RegisterActivity.java   
public void onBirthdayClick(View view) {
    if (mDatePickerDialog == null) {
        mDatePickerDialog = new DatePickerDialog(RegisterActivity.this,
                new OnDateSetListener() {
                    @Override
                    public void onDateSet(DatePicker view, int year,
                            int monthOfYear, int dayOfMonth) {
                        // TODO Auto-generated method stub
                        mBirthdayEditText.setText(String.format(
                                "%04d-%02d-%02d", year, monthOfYear + 1,
                                dayOfMonth));
                        mCalendar.set(Calendar.YEAR, year);
                        mCalendar.set(Calendar.MONTH, monthOfYear);
                        mCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
                    }
                }, 1980, 0, 1);
        mCalendar.set(Calendar.YEAR, 1980);
        mCalendar.set(Calendar.MONTH, 0);
        mCalendar.set(Calendar.DAY_OF_MONTH, 1);
        mDatePickerDialog.setCanceledOnTouchOutside(true);
        mDatePickerDialog
                .setTitle(getString(R.string.str_hint_select_birthday));
    }
    mDatePickerDialog.show();
}
项目:iWish    文件:RegisterActivity.java   
private void setDateTimeField() {
    edt_birthday.setOnFocusChangeListener(this);

    Calendar newCalendar = Calendar.getInstance();
    BirthdayDatePickerDialog = new DatePickerDialog(this, R.style.DatePickerStyle, new OnDateSetListener() {
        //     BirthdayDatePickerDialog = new DatePickerDialog(this, new OnDateSetListener() {

        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            Calendar newDate = Calendar.getInstance();
            newDate.set(year, monthOfYear, dayOfMonth);
            edt_birthday.setText(dateFormatter.format(newDate.getTime()));
        }

    },newCalendar.get(Calendar.YEAR), newCalendar.get(Calendar.WEEK_OF_MONTH), newCalendar.get(Calendar.DAY_OF_MONTH));

    BirthdayDatePickerDialog.setTitle("");

}
项目:elfyz-data-mobile-logger    文件:AAnalysisFragment.java   
public void selectDateFrom() {
  DatePickerFragment dialog = new DatePickerFragment();
  if(dateFrom != null) {
    Bundle args = new Bundle(1);
    args.putLong(DatePickerFragment.ARG_INITIAL_DATE, dateFrom.getTime());
    dialog.setArguments(args);
  }
  dialog.setListener(new OnDateSetListener() {
    @Override
    public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
      dateFrom = DateUtils.getDate(year, monthOfYear, dayOfMonth).getTime();
      refreshButtons();
      refreshAnalysis();
    }
  });
  dialog.show(getFragmentManager(), "datePicker");
}
项目:elfyz-data-mobile-logger    文件:AAnalysisFragment.java   
public void selectDateTo() {
  DatePickerFragment dialog = new DatePickerFragment();
  if(dateTo != null) {
    Bundle args = new Bundle(1);
    args.putLong(DatePickerFragment.ARG_INITIAL_DATE, dateTo.getTime());
    dialog.setArguments(args);
  }
  dialog.setListener(new OnDateSetListener() {
    @Override
    public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
      dateTo = DateUtils.getDate(year, monthOfYear, dayOfMonth).getTime();
      refreshButtons();
      refreshAnalysis();
    }
  });
  dialog.show(getFragmentManager(), "datePicker");
}
项目:android-for-dummies-v3    文件:DatePickerDialogFragment.java   
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    // Find the TaskEditFragment that created this dialog by name.
    // We'll use that fragment as the edit callback,
    // so that when the user chooses a new date in our datepicker
    // dialog, the dialog will call back into the edit fragment to
    // set the new date.
    OnDateSetListener callback = (OnDateSetListener)
            getFragmentManager()
                    .findFragmentByTag
                            (TaskEditFragment
                                    .DEFAULT_FRAGMENT_TAG);

    // Construct a new DatePicker dialog that will be hosted by
    // this fragment. Set its Year, Month, and Day to the values
    // specified in the args bundle
    Bundle args = getArguments();
    return new DatePickerDialog(getActivity(), callback,
            args.getInt(YEAR),
            args.getInt(MONTH),
            args.getInt(DAY));
}
项目:Android-Project-Manager    文件:EditProject.java   
public void showDatePickerDialog(View v, String tag, final EditText dateEditText, final int[] dateStrings) {
    DatePickerFragment datePicker = new DatePickerFragment();

    Calendar calender = Calendar.getInstance();
    Bundle args = new Bundle();
    args.putInt("year", calender.get(Calendar.YEAR));
    args.putInt("month", calender.get(Calendar.MONTH));
    args.putInt("day", calender.get(Calendar.DAY_OF_MONTH));
    datePicker.setArguments(args);

    OnDateSetListener ondate = new OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int month, int day) {
            dateEditText.setText(day + "/" + (month + 1) + "/" + year);
            dateStrings[0] = year;
            dateStrings[1] = month + 1;
            dateStrings[2] = day;
        }
    };
    datePicker.setCallBack(ondate);
    datePicker.show(getFragmentManager(), tag);
}
项目:Android-Project-Manager    文件:NewTask.java   
public void showDatePickerDialog(View v, String tag, final EditText dateEditText, final int[] dateStrings) {
    DatePickerFragment datePicker = new DatePickerFragment();

    Calendar calender = Calendar.getInstance();
    Bundle args = new Bundle();
    args.putInt("year", calender.get(Calendar.YEAR));
    args.putInt("month", calender.get(Calendar.MONTH));
    args.putInt("day", calender.get(Calendar.DAY_OF_MONTH));
    datePicker.setArguments(args);

    OnDateSetListener ondate = new OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int month, int day) {
            dateEditText.setText(day + "/" + (month + 1) + "/" + year);
            dateStrings[0] = year;
            dateStrings[1] = month + 1;
            dateStrings[2] = day;
        }
    };
    datePicker.setCallBack(ondate);
    datePicker.show(getFragmentManager(), tag);
}
项目:Android-Project-Manager    文件:NewProject.java   
public void showDatePickerDialog(View v, String tag, final EditText dateEditText, final int[] date) {
    DatePickerFragment datePicker = new DatePickerFragment();

    Calendar calender = Calendar.getInstance();
    Bundle args = new Bundle();
    args.putInt("year", calender.get(Calendar.YEAR));
    args.putInt("month", calender.get(Calendar.MONTH));
    args.putInt("day", calender.get(Calendar.DAY_OF_MONTH));
    datePicker.setArguments(args);

    OnDateSetListener ondate = new OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int month, int day) {
            dateEditText.setText(day + "/" + (month + 1) + "/" + year);
            date[0] = year;
            date[1] = month + 1;
            date[2] = day;
        }
    };
    datePicker.setCallBack(ondate);
    datePicker.show(getFragmentManager(), tag);
}
项目:aceim    文件:DatePickerListener.java   
@Override
protected AlertDialog createDialog(final Calendar cal) {
    OnDateSetListener callback = new OnDateSetListener() {

        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            cal.set(Calendar.YEAR, year);
            cal.set(Calendar.MONTH, monthOfYear);
            cal.set(Calendar.DAY_OF_MONTH, dayOfMonth);
            listener.onValuePicked(String.valueOf(cal.getTimeInMillis()));
        }
    };

    DatePickerDialog dialog = new DatePickerDialog(activity, callback, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
    return dialog;
}
项目:quickhybrid-android    文件:DialogUtil.java   
/**
 * 日期和时间选择对话框,选选择日期后选择时间
 *
 * @param con      上下文
 * @param title1   日期选择标题
 * @param title2   事件选择标题
 * @param calendar 默认日期
 * @param listener 时间选择事件
 */
public static void pickDateTime(final Context con, String title1, final String title2, final Calendar calendar, final OnTimeSetListener listener) {
    // 增加判断,解决4.X系统可能存在的弹出多个时间选择器的问题
    final boolean[] isShowTime = {false};
    pickDate(con, title1, calendar, new OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
            calendar.set(year, month, dayOfMonth);
            if (!isShowTime[0]) {
                isShowTime[0] = true;
                pickTime(con, title2, calendar, listener);
            }
        }
    });
}
项目:quickhybrid-android    文件:DialogUtil.java   
/**
 * 年月选择对话框
 *
 * @param con
 * @param title
 * @param calendar
 * @param listener
 */
public static void pickMonth(Context con, String title, Calendar calendar, final OnDateSetListener listener) {
    LinearLayout ll = new LinearLayout(con);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    ll.setLayoutParams(layoutParams);
    ll.setOrientation(LinearLayout.VERTICAL);
    //添加一条线
    LinearLayout line = new LinearLayout(con);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 1);
    line.setBackgroundColor(con.getResources().getColor(R.color.line));
    line.setLayoutParams(lp);
    ll.addView(line);
    //添加选择器控件
    final DatePicker datePicker = new DatePicker(con, null, themeId);
    datePicker.setLayoutParams(layoutParams);
    datePicker.init(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), null);
    datePicker.setCalendarViewShown(false);
    ll.addView(datePicker);
    //初始化对话框
    QuickDialog.Builder builder = new QuickDialog.Builder(con);
    builder.setContentView(ll);
    builder.setTitle(title);
    builder.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            listener.onDateSet(datePicker, datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth());
        }
    });
    builder.create().show();
}
项目:FuelUp    文件:EditExpenseActivity.java   
/**
 * OnClick listener for date text view
 */
public void onClickDatePicker(View view) {
    new DatePickerDialog(EditExpenseActivity.this, new OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker datePicker, int y, int m, int d) {
            Calendar serviceDate = Calendar.getInstance();
            serviceDate.set(y, m, d);
            setExpenseDate(serviceDate);
        }
    }, expenseDate.get(Calendar.YEAR), expenseDate.get(Calendar.MONTH), expenseDate.get(Calendar.DAY_OF_MONTH)).show();
}
项目:financisto1-holo    文件:RecurrenceViewFactory.java   
@Override
protected void onClick(View v, int id) {
    new DatePickerDialog(activity, new OnDateSetListener(){
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            c.set(Calendar.YEAR, year);
            c.set(Calendar.MONTH, monthOfYear);
            c.set(Calendar.DAY_OF_MONTH, dayOfMonth);
            onDateText.setText(DateUtils.getMediumDateFormat(activity).format(c.getTime()));                        
        }               
    }, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)).show();
}
项目:RemindrApp-Android    文件:DatePickerDialogFragment.java   
@Override
public Dialog onCreateDialog(Bundle savedInstanceState){
    OnDateSetListener callback = (OnDateSetListener)
            getFragmentManager().findFragmentByTag(TaskEditFragment.DEFAULT_FRAGMENT_TAG);
    Bundle args = getArguments();
    return new DatePickerDialog(getActivity(),callback,args.getInt(YEAR),args.getInt(MONTH),args.getInt(DAY));
}
项目:PEP---Notes    文件:DatePickerDialogFragment.java   
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    if (getArguments().containsKey(DEFAULT_DATE)) {
        this.defaultDate = getArguments().getLong(DEFAULT_DATE);
    }

    try {
        mListener = (OnDateSetListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString()
                + " must implement OnDateSetListener");
    }
}
项目:PEP---Notes    文件:ReminderPickers.java   
/**
 * Show date and time pickers
 */
protected void showDateTimeSelectors(long reminder) {

    // Sets actual time or previously saved in note
    final Calendar now = DateHelper.getCalendar(reminder);
    DatePickerDialog mCalendarDatePickerDialog = DatePickerDialog.newInstance(
            new DatePickerDialog.OnDateSetListener() {

                @Override
                public void onDateSet(DatePickerDialog dialog, int year, int monthOfYear, int dayOfMonth) {
                    reminderYear = year;
                    reminderMonth = monthOfYear;
                    reminderDay = dayOfMonth;
                    TimePickerDialog mRadialTimePickerDialog = TimePickerDialog.newInstance(
                            new TimePickerDialog.OnTimeSetListener() {

                                @Override
                                public void onTimeSet(RadialPickerLayout radialPickerLayout, int hour, int minute) {
                                    hourOfDay = hour;
                                    minutes = minute;
                                    showRecurrencePickerDialog(recurrenceRule);
                                }
                            }, now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE), 
                            DateHelper.is24HourMode(mActivity));
                    mRadialTimePickerDialog.show(mActivity.getSupportFragmentManager(), Constants.TAG);
                }

            }, now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH));
    mCalendarDatePickerDialog.show(mActivity.getSupportFragmentManager(), Constants.TAG);
}
项目:flowzr-android-black    文件:RecurrenceViewFactory.java   
@Override
protected void onClick(View v, int id) {
    new DatePickerDialog(activity, new OnDateSetListener(){
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            c.set(Calendar.YEAR, year);
            c.set(Calendar.MONTH, monthOfYear);
            c.set(Calendar.DAY_OF_MONTH, dayOfMonth);
            onDateText.setText(DateUtils.getMediumDateFormat(activity).format(c.getTime()));                        
        }               
    }, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)).show();
}
项目:RemindrApp-Android    文件:DatePickerDialogFragment.java   
@Override
public Dialog onCreateDialog(Bundle savedInstanceState){
    OnDateSetListener callback = (OnDateSetListener)
            getFragmentManager().findFragmentByTag(TaskEditFragment.DEFAULT_FRAGMENT_TAG);
    Bundle args = getArguments();
    return new DatePickerDialog(getActivity(),callback,args.getInt(YEAR),args.getInt(MONTH),args.getInt(DAY));
}
项目:AndroidDemos    文件:MainActivity.java   
private void setBtn_dataClickListener(View view) {
    DatePickerDialog dpd = new DatePickerDialog(MainActivity.this,
            new OnDateSetListener() {
                @Override
                public void onDateSet(DatePicker p, int year, int month,
                        int day) {
                    btn_data.setText(year + "年" + (month + 1) + "月" + day
                            + "日");
                }
            }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
            calendar.get(Calendar.DAY_OF_MONTH));
    dpd.show();
}
项目:dhis2-android-eventcapture    文件:FormSectionActivity.java   
private void showDatePickerDialog() {
    final OnDateSetListener onDateSetListener = new OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            Calendar calendar = Calendar.getInstance();
            calendar.set(Calendar.YEAR, year);
            calendar.set(Calendar.MONTH, monthOfYear);
            calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);

            String stringDate = (new SimpleDateFormat(DATE_FORMAT, Locale.US))
                    .format(calendar.getTime());
            String newValue = String.format(Locale.getDefault(), "%s: %s",
                    getString(R.string.report_date), stringDate);
            textViewReportDate.setText(newValue);

            DateTime currentDateTime = DateTime.now();
            DateTime selectedDateTime = DateTime.parse(stringDate);

            /*
            * in case when user selected today's date, we need to know about time as well.
            * selectedDateTime does not contain time information (only date), that's why we
            * need to create a new DateTime object by calling DateTime.now()
            */
            DateTime dateTime;
            if (DateTimeComparator.getDateOnlyInstance()
                    .compare(currentDateTime, selectedDateTime) == 0) {
                dateTime = currentDateTime;
            } else {
                dateTime = selectedDateTime;
            }

            formSectionPresenter.saveEventDate(getEventUid(), dateTime);
        }
    };

    DatePickerDialogFragment datePickerDialogFragment =
            DatePickerDialogFragment.newInstance(false);
    datePickerDialogFragment.setOnDateSetListener(onDateSetListener);
    datePickerDialogFragment.show(getSupportFragmentManager());
}
项目:BioStar2Android    文件:DateTimePicker.java   
public void showDatePicker(OnDateSetListener dateSetListener, int year, int month, int day) {
        if (mActivity.isFinishing()) {
            return;
        }
        close();
        dlgDate = new DatePickerDialog(mActivity, dateSetListener, year, month, day);
        dlgDate.show();
//      DialogFragment datePicker = new DatePickerFragment(dateSetListener, year, month, day);
//      try {
//          datePicker.show(mActivity.getSupportFragmentManager(), "datePicker");
//      } catch (Exception e) {
//          Log.e(TAG, "showDatePicker " + e.getMessage());
//      }
    }
项目:stardroid    文件:TimeTravelDialog.java   
private Dialog createDatePicker() {
  OnDateSetListener dateSetListener = new DatePickerDialog.OnDateSetListener() {
    public void onDateSet(DatePicker view, int year,
                          int monthOfYear, int dayOfMonth) {
      setDate(year, monthOfYear, dayOfMonth);
      Log.d(TAG, "Setting date to: " + year + "-" + monthOfYear + "-" + dayOfMonth);
    }
  };
  return new DatePickerDialog(getContext(),
                              dateSetListener,
                              calendar.get(Calendar.YEAR),
                              calendar.get(Calendar.MONTH),
                              calendar.get(Calendar.DAY_OF_MONTH)) {
  };
}
项目:droidwells    文件:Device.java   
public static void ShowDateDialog(Context context,String message,OnDateSetListener listener)
{
    Calendar c=Calendar.getInstance();
    int y=c.get(Calendar.YEAR);
    int m=c.get(Calendar.MONTH);
    int d=c.get(Calendar.DAY_OF_MONTH);

    DatePickerDialog dlg=new DatePickerDialog(context, listener, y, m, d);
    //dlg.setOnCancelListener(cancelListener);
    //dlg.setMessage(message);
    dlg.setTitle(message);
    dlg.show();
}
项目:eCarNet    文件:CustomizeCarActivity.java   
public static DatePickerFragment newInstance(Calendar date, OnDateSetListener onDateSetListener) {
    DatePickerFragment pickerFragment = new DatePickerFragment();
    pickerFragment.setOnDateSetListener(onDateSetListener);

    //Pass the date in a bundle.
    Bundle bundle = new Bundle();
    bundle.putSerializable("SELECTED_DATE", date);
    pickerFragment.setArguments(bundle);
    return pickerFragment;
}
项目:eCarNet    文件:AddInterventionActivity.java   
public static DatePickerFragment newInstance(Calendar date, OnDateSetListener onDateSetListener) {
    DatePickerFragment pickerFragment = new DatePickerFragment();
    pickerFragment.setOnDateSetListener(onDateSetListener);

    //Pass the date in a bundle.
    Bundle bundle = new Bundle();
    bundle.putSerializable("SELECTED_DATE", date);
    pickerFragment.setArguments(bundle);
    return pickerFragment;
}
项目:ClubHelperAndroid    文件:PersonDetailFragment.java   
private OnDateSetListener createDateSetListener() {
    OnDateSetListener l = new OnDateSetListener() {

        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            controller.setBirthdate(year, monthOfYear, dayOfMonth);
        }
    };
    return l;
}
项目:androblip    文件:DFragementDatePicker.java   
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    // Verify that the host activity implements the callback interface
    try {
        // Instantiate the NoticeDialogListener so we can send events to the host
        mListener = (OnDateSetListener) activity;
    } catch (ClassCastException e) {
        // The activity doesn't implement the interface, throw exception
        throw new ClassCastException(activity.toString()
                + " must implement OnDateSetListener");
    }
}
项目:omni-note    文件:DatePickerFragment.java   
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    mActivity = (Activity)activity;
    if (getArguments().containsKey(DEFAULT_DATE)) {
        this.defaultDate = getArguments().getLong(DEFAULT_DATE);
    }

    try {
        mListener = (OnDateSetListener) mActivity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString()
                + " must implement OnDateSetListener");
    }
}
项目:droidwells    文件:Device.java   
public static void ShowDateDialog(Context context,String message,OnDateSetListener listener)
{
    Calendar c=Calendar.getInstance();
    int y=c.get(Calendar.YEAR);
    int m=c.get(Calendar.MONTH);
    int d=c.get(Calendar.DAY_OF_MONTH);

    DatePickerDialog dlg=new DatePickerDialog(context, listener, y, m, d);
    //dlg.setOnCancelListener(cancelListener);
    //dlg.setMessage(message);
    dlg.setTitle(message);
    dlg.show();
}
项目:jsWebView    文件:MainActivity.java   
@JavascriptInterface
public void chooseDate(String date, final String eleId) {
    String[] dateParts = date.split("-");
    new DatePickerDialog(
            MainActivity.this,
            new OnDateSetListener() {
                @Override
                public void onDateSet(DatePicker view, int year,
                        int monthOfYear, int dayOfMonth) {
                    // Toast.makeText(MainActivity.this,
                    // year + "-" + monthOfYear + "-" + dayOfMonth, 0)
                    // .show();
                    String dateString = year
                            + "-"
                            + ((monthOfYear + 1) < 10 ? "0"
                                    + (monthOfYear + 1)
                                    : (monthOfYear + 1))
                            + "-"
                            + (dayOfMonth < 10 ? "0" + dayOfMonth
                                    : dayOfMonth);
                    // 不支持非UI线程调用
                    // wv.loadUrl("javascript:setDate(" + dateString +
                    // "," + eleId
                    // + ")");
                    Message msg = new Message();

                    Bundle bundle = new Bundle();
                    bundle.putString("dateString", dateString);
                    bundle.putString("eleId", eleId);

                    msg.setData(bundle);
                    handler.sendMessage(msg);

                }
            }, Integer.parseInt(dateParts[0]),
            Integer.parseInt(dateParts[1]) - 1, Integer
                    .parseInt(dateParts[2])).show();

}
项目:NexusDialog    文件:DatePickerController.java   
private void showDatePickerDialog(final Context context, final EditText editText) {
    // don't show dialog again if it's already being shown
    if (datePickerDialog == null) {
        Date date = (Date)getModel().getValue(getName());
        if (date == null) {
            date = new Date();
        }
        Calendar calendar = Calendar.getInstance(Locale.getDefault());
        calendar.setTimeZone(timeZone);
        calendar.setTime(date);

        datePickerDialog = new DatePickerDialog(context, new OnDateSetListener() {
            @Override
            public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                Calendar calendar = Calendar.getInstance(Locale.getDefault());
                calendar.setTimeZone(timeZone);
                calendar.set(year, monthOfYear, dayOfMonth);
                getModel().setValue(getName(), calendar.getTime());
                editText.setText(displayFormat.format(calendar.getTime()));

            }
        }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));

        datePickerDialog.setOnDismissListener(new OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                datePickerDialog = null;
            }
        });

        datePickerDialog.show();
    }
}
项目:quickhybrid-android    文件:DialogUtil.java   
public static void pickDate(Context con, String title, OnDateSetListener listener) {
    Calendar calendar = Calendar.getInstance();
    pickDate(con, title, calendar, listener);
}
项目:quickhybrid-android    文件:DialogUtil.java   
public static void pickDate(Context con, OnDateSetListener listener) {
    pickDate(con, con.getString(R.string.pick_date), listener);
}