Android 时间控件修改生日

 private class TextView_persinal_birth_onClick implements View.OnClickListener {
        @Override
        public void onClick(View v) {
            DatePickerDialog.OnDateSetListener dateSetListener=new DatePickerDialog.OnDateSetListener() {
                @Override
                public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                    calendar.set(Calendar.YEAR,year);
                    calendar.set(Calendar.MONTH,monthOfYear);
                    calendar.set(Calendar.DAY_OF_MONTH,dayOfMonth);
                    try {
                        Date date_input=simpleDateFormat.parse(simpleDateFormat.format(calendar.getTime()));
                        Date date_system=simpleDateFormat.parse(simpleDateFormat.format(Calendar.getInstance().getTime()));
                        long inputTime=date_input.getTime();
                        long systemTime=date_system.getTime();
                        if (inputTime<=systemTime){
                            birth=simpleDateFormat.format(calendar.getTime());
                            textView_persional_birth.setText(birth);
                        }
                        else
                            Toast.makeText(PersonalInformationActivity.this,"生日不能大于当前日期!",1).show();

                    } catch (ParseException e) {
                        e.printStackTrace();
                    }


                }
            };
            new DatePickerDialog(PersonalInformationActivity.this,
                dateSetListener,
                calendar.get(Calendar.YEAR),
                calendar.get(Calendar.MONTH),
                calendar.get(Calendar.DAY_OF_MONTH)).show();
        }
    }

Android 时间控件修改生日,布布扣,bubuko.com

Android 时间控件修改生日

上一篇:转:android 自定义RadioButton样式


下一篇:Android 图片剪裁