Example usage for android.app DatePickerDialog DatePickerDialog

List of usage examples for android.app DatePickerDialog DatePickerDialog

Introduction

In this page you can find the example usage for android.app DatePickerDialog DatePickerDialog.

Prototype

public DatePickerDialog(@NonNull Context context, @Nullable OnDateSetListener listener, int year, int month,
        int dayOfMonth) 

Source Link

Document

Creates a new date picker dialog for the specified date using the parent context's default date picker dialog theme.

Usage

From source file:mobisocial.bento.ebento.ui.EditFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    if (savedInstanceState != null) {
        mbImageChanged = savedInstanceState.getBoolean(INSTANCE_STATE_IMAGE_CHANGED);
    }//from w w w.  j ava2 s. c om

    mTargetWidth = (UIUtils.isTablet(getActivity()) ? MAX_IMG_WIDTH_TABLET : MAX_IMG_WIDTH_PHONE);
    mTargetHeight = (UIUtils.isTablet(getActivity()) ? MAX_IMG_HEIGHT_TABLET : MAX_IMG_HEIGHT_PHONE);

    // Check if this activity launched from internal activity or not
    if (getActivity().getIntent().hasExtra(EditActivity.EXTRA_EDIT)) {
        mbNewEventMode = false;
    }

    // Event
    Event event = new Event();
    if (!mbNewEventMode) {
        event = mManager.getEvent();
    }

    // View
    mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_edit, container);

    // EditText
    View.OnFocusChangeListener unfocusListener = new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean flag) {
            if (flag == false) {
                InputMethodManager imm = (InputMethodManager) getActivity()
                        .getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
            }
        }
    };
    mTitle = (EditText) mRootView.findViewById(R.id.title);
    mTitle.setOnFocusChangeListener(unfocusListener);
    if (!mbNewEventMode)
        mTitle.setText(event.title);
    mPlace = (EditText) mRootView.findViewById(R.id.place);
    mPlace.setOnFocusChangeListener(unfocusListener);
    if (!mbNewEventMode)
        mPlace.setText(event.place);
    mDetails = (EditText) mRootView.findViewById(R.id.details);
    mDetails.setOnFocusChangeListener(unfocusListener);
    if (!mbNewEventMode)
        mDetails.setText(event.details);

    // Date & Time Picker
    // TODO : All day option
    if (mbNewEventMode) {
        // start
        mStartDateTime = DateTimeUtils.getRoundedCurrentDateTime();
        // end
        mEndDateTime = DateTimeUtils.getOneHourAheadEndTimeFromStartTime(mStartDateTime);
    } else {
        // start
        mStartDateTime.year = event.startDate.year;
        mStartDateTime.month = event.startDate.month;
        mStartDateTime.day = event.startDate.day;
        mStartDateTime.hour = event.startTime.hour;
        mStartDateTime.minute = event.startTime.minute;
        // end
        mEndDateTime.year = event.endDate.year;
        mEndDateTime.month = event.endDate.month;
        mEndDateTime.day = event.endDate.day;
        mEndDateTime.hour = event.endTime.hour;
        mEndDateTime.minute = event.endTime.minute;
    }
    mStartDateButton = (Button) mRootView.findViewById(R.id.start_date_button);
    mEndDateButton = (Button) mRootView.findViewById(R.id.end_date_button);
    mStartTimeButton = (Button) mRootView.findViewById(R.id.start_time_button);
    mEndTimeButton = (Button) mRootView.findViewById(R.id.end_time_button);
    setDateTimeButtonText();

    // Date
    mStartDateButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            final DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(),
                    new DatePickerDialog.OnDateSetListener() {
                        @Override
                        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                            DateTime candidateStart = new DateTime();
                            candidateStart.year = year;
                            candidateStart.month = (monthOfYear + 1);
                            candidateStart.day = dayOfMonth;
                            candidateStart.hour = mStartDateTime.hour;
                            candidateStart.minute = mStartDateTime.minute;
                            if (DateTimeUtils.isPastDateTime(candidateStart)) {
                                Toast.makeText(getActivity(), R.string.toast_edit_past_time, Toast.LENGTH_SHORT)
                                        .show();
                            } else {
                                mStartDateTime.year = year;
                                mStartDateTime.month = (monthOfYear + 1);
                                mStartDateTime.day = dayOfMonth;

                                mEndDateTime = DateTimeUtils.getEndTimeFromStartTime(mStartDateTime,
                                        mEndDateTime);
                                setDateTimeButtonText();
                            }
                        }
                    }, mStartDateTime.year, (mStartDateTime.month - 1), mStartDateTime.day);
            datePickerDialog.show();
        }
    });

    mEndDateButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            final DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(),
                    new DatePickerDialog.OnDateSetListener() {
                        @Override
                        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                            DateTime candidateEnd = new DateTime();
                            candidateEnd.year = year;
                            candidateEnd.month = (monthOfYear + 1);
                            candidateEnd.day = dayOfMonth;
                            candidateEnd.hour = mEndDateTime.hour;
                            candidateEnd.minute = mEndDateTime.minute;

                            DateTime candidateStart = new DateTime();
                            candidateStart.year = mStartDateTime.year;
                            candidateStart.month = mStartDateTime.month;
                            candidateStart.day = mStartDateTime.day;
                            candidateStart.hour = mStartDateTime.hour;
                            candidateStart.minute = mStartDateTime.minute;
                            candidateStart = DateTimeUtils.getStartTimeFromEndTime(candidateStart,
                                    candidateEnd);

                            if (DateTimeUtils.isPastDateTime(candidateStart)
                                    || DateTimeUtils.isPastDateTime(candidateEnd)) {
                                Toast.makeText(getActivity(), R.string.toast_edit_past_time, Toast.LENGTH_SHORT)
                                        .show();
                            } else {
                                mEndDateTime.year = year;
                                mEndDateTime.month = (monthOfYear + 1);
                                mEndDateTime.day = dayOfMonth;

                                mStartDateTime = DateTimeUtils.getStartTimeFromEndTime(mStartDateTime,
                                        mEndDateTime);
                                setDateTimeButtonText();
                            }
                        }
                    }, mEndDateTime.year, (mEndDateTime.month - 1), mEndDateTime.day);
            datePickerDialog.show();
        }
    });

    // Time
    mStartTimeButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            final TimePickerDialog timePickerDialog = new FiveMinutesIntervalTimePickerDialog(getActivity(),
                    new TimePickerDialog.OnTimeSetListener() {
                        @Override
                        public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                            DateTime candidateStart = new DateTime();
                            candidateStart.year = mStartDateTime.year;
                            candidateStart.month = mStartDateTime.month;
                            candidateStart.day = mStartDateTime.day;
                            candidateStart.hour = hourOfDay;
                            candidateStart.minute = minute;
                            if (DateTimeUtils.isPastDateTime(candidateStart)) {
                                Toast.makeText(getActivity(), R.string.toast_edit_past_time, Toast.LENGTH_SHORT)
                                        .show();
                            } else {
                                mStartDateTime.hour = hourOfDay;
                                mStartDateTime.minute = minute;

                                mEndDateTime = DateTimeUtils.getEndTimeFromStartTime(mStartDateTime,
                                        mEndDateTime);
                                setDateTimeButtonText();
                            }
                        }
                    }, mStartDateTime.hour, mStartDateTime.minute, false);
            timePickerDialog.show();
        }
    });

    mEndTimeButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            final TimePickerDialog timePickerDialog = new FiveMinutesIntervalTimePickerDialog(getActivity(),
                    new TimePickerDialog.OnTimeSetListener() {
                        @Override
                        public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                            DateTime candidateEnd = new DateTime();
                            candidateEnd.year = mEndDateTime.year;
                            candidateEnd.month = mEndDateTime.month;
                            candidateEnd.day = mEndDateTime.day;
                            candidateEnd.hour = hourOfDay;
                            candidateEnd.minute = minute;

                            DateTime candidateStart = new DateTime();
                            candidateStart.year = mStartDateTime.year;
                            candidateStart.month = mStartDateTime.month;
                            candidateStart.day = mStartDateTime.day;
                            candidateStart.hour = mStartDateTime.hour;
                            candidateStart.minute = mStartDateTime.minute;
                            candidateStart = DateTimeUtils.getStartTimeFromEndTime(candidateStart,
                                    candidateEnd);

                            if (DateTimeUtils.isPastDateTime(candidateStart)
                                    || DateTimeUtils.isPastDateTime(candidateEnd)) {
                                Toast.makeText(getActivity(), R.string.toast_edit_past_time, Toast.LENGTH_SHORT)
                                        .show();
                            } else {
                                mEndDateTime.hour = hourOfDay;
                                mEndDateTime.minute = minute;

                                mStartDateTime = DateTimeUtils.getStartTimeFromEndTime(mStartDateTime,
                                        mEndDateTime);
                                setDateTimeButtonText();
                            }
                        }
                    }, mEndDateTime.hour, mEndDateTime.minute, false);
            timePickerDialog.show();
        }
    });

    // Image
    mImageButton = (Button) mRootView.findViewById(R.id.image_button);
    mImageButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            goPicture(v);
        }
    });

    mImageView = (ImageView) mRootView.findViewById(R.id.image);
    if (mbNewEventMode) {
        if (!mbImageChanged) {
            sImageOrg = null;
        }
    } else {
        if (!mbImageChanged) {
            sImageOrg = event.image;
        }
    }

    if (sImageOrg != null) {
        mImageView.setImageBitmap(BitmapHelper.getResizedBitmap(sImageOrg, mTargetWidth, mTargetHeight, 0));
        mImageView.setVisibility(View.VISIBLE);
    } else {
        mImageView.setVisibility(View.GONE);
    }

    // Quick Action
    ActionItem cameraItem = new ActionItem(REQUEST_IMAGE_CAPTURE,
            getResources().getString(R.string.label_camera),
            getResources().getDrawable(R.drawable.ic_menu_camera));
    ActionItem galleryItem = new ActionItem(REQUEST_GALLERY, getResources().getString(R.string.label_gallery),
            getResources().getDrawable(R.drawable.ic_menu_gallery));
    ActionItem removeItem = new ActionItem(REQUEST_REMOVE,
            getResources().getString(R.string.label_remove_picture),
            getResources().getDrawable(R.drawable.ic_menu_remove_picture));

    mQuickAction = new QuickAction(getActivity());
    mQuickAction.addActionItem(cameraItem);
    mQuickAction.addActionItem(galleryItem);
    mQuickAction.addActionItem(removeItem);
    mQuickAction.setOnActionItemClickListener(new QuickAction.OnActionItemClickListener() {
        @Override
        public void onItemClick(QuickAction quickAction, int pos, int actionId) {
            if (actionId == REQUEST_IMAGE_CAPTURE) {
                goCamera();
            } else if (actionId == REQUEST_GALLERY) {
                goGallery();
            } else {
                goRemovePicture();
            }
        }
    });
    mQuickAction.setOnDismissListener(new QuickAction.OnDismissListener() {
        @Override
        public void onDismiss() {
        }
    });

    // Add Cal
    mAddCalCheckBox = (CheckBox) mRootView.findViewById(R.id.add_cal_checkbox);
    mAddCalText = (TextView) mRootView.findViewById(R.id.add_cal_text);
    mAddCalLayout = (LinearLayout) mRootView.findViewById(R.id.add_cal_layout);
    mAddCalSub = (TextView) mRootView.findViewById(R.id.add_cal_sub);

    if (!mbNewEventMode) {
        mAddCalText.setVisibility(View.GONE);
        mAddCalLayout.setVisibility(View.GONE);
    } else {
        // not ICS
        if (!UIUtils.isIceCreamSandwich()) {
            mAddCalSub.setVisibility(View.GONE);
        }
    }

    // Save/Cancel Buttons
    mSaveButton = (Button) mRootView.findViewById(R.id.save_button);
    mSaveButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            goSave();
        }
    });
    mCancelButton = (Button) mRootView.findViewById(R.id.cancel_button);
    mCancelButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            getActivity().finish();
        }
    });

    return mRootView;
}

From source file:com.ubundude.timesheet.MainUIFragment.java

/** 
 * Method to get the current date form// w w  w.  ja  v  a  2s .co m
 * 
 * Displays the formatted dates in the proper places 
 * and makes them available for usage elsewhere.
 * 
 * @return date The current date formatted for SQL queries.
 */
private String initialDates() {
    Log.d("Initial Dates", "Funcion Entred");
    dateView = formDate.format(c.getTime());
    date = formDate.format(c.getTime());
    Log.d("Initial Dates", "Dates Formated");

    /** Sets the text in the dateEditText to the current date */
    dateEditText = (EditText) getView().findViewById(R.id.dateEditText);
    dateEditText.setText(dateView, TextView.BufferType.NORMAL);
    dateEditText.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Log.d("Initial Dates", "In the On Click Listener");
            int year, month, dayOfMonth;
            year = Integer.valueOf(dateEditText.getText().toString().substring(6));
            month = Integer.valueOf(dateEditText.getText().toString().substring(0, 2)) - 1;
            dayOfMonth = Integer.valueOf(dateEditText.getText().toString().substring(3, 5));
            new DatePickerDialog(getActivity(), d, year, month, dayOfMonth).show();
        }
    });

    return date;
}

From source file:shetye.prathamesh.notifyme.Utilities.java

public void createWhenDialog(final Context context, final Activity parentActivity, final Notif note,
        final boolean back) {
    mDialog = new Dialog(context);
    mDialog.setContentView(R.layout.datetimepicker_dialog);
    mDialog.setTitle("When to Notify??");
    mDialogOKBtn = (Button) mDialog.findViewById(R.id.btn_ok);
    mDialogOKBtn.setOnClickListener(new View.OnClickListener() {
        @Override/*from   w  w  w  .  ja  va  2 s  . c o  m*/
        public void onClick(View v) {
            note.setNotification_when(getSelectedTime());
            DatabaseHelper.getInstance(context).addNotif(note);
            setZoneInTimer(context, note);
            mDialog.dismiss();
            if (parentActivity != null) {
                if (back) {
                    parentActivity.finishAfterTransition();
                } else {
                    ((Notifications) parentActivity).refreshNotifications();
                }
            }
        }
    });
    mDialogOKBtn.setEnabled(false);
    mDialogCancelBtn = (Button) mDialog.findViewById(R.id.btn_cancel);
    mDialogCancelBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mDialog.dismiss();
            if (parentActivity != null) {
                parentActivity.finishAfterTransition();
            }
        }
    });
    mTimeBtn = (Button) mDialog.findViewById(R.id.btntimeset);
    mDateBtn = (Button) mDialog.findViewById(R.id.btndateset);
    final Time dtNow = new Time();
    dtNow.setToNow();
    mSelectedHours = dtNow.hour;
    mSelectedMinutes = dtNow.minute;
    mSelectedYear = dtNow.year;
    mSelectedMonth = dtNow.month;
    mSelectedDay = dtNow.monthDay;
    updateBtnText(dtNow, false, context);
    Time selectedTime = new Time();
    selectedTime.set(0, mSelectedMinutes, mSelectedHours, mSelectedDay, mSelectedMonth, mSelectedYear);
    mPastDateSelected = true;
    mTimeBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            TimePickerDialog timePickerDialog = new TimePickerDialog(context,
                    new TimePickerDialog.OnTimeSetListener() {
                        @Override
                        public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                            Time selectedTime = new Time();
                            mSelectedHours = hourOfDay;
                            mSelectedMinutes = minute;
                            selectedTime.set(0, mSelectedMinutes, mSelectedHours, mSelectedDay, mSelectedMonth,
                                    mSelectedYear);
                            if (Time.compare(selectedTime, dtNow) <= 0) {
                                mPastDateSelected = true;
                            } else {
                                mPastDateSelected = false;
                            }
                            updateBtnText(selectedTime, true, context);
                        }
                    }, mSelectedHours, mSelectedMinutes, false);
            timePickerDialog.show();
        }
    });
    mDateBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            DatePickerDialog datePickerDialog = new DatePickerDialog(context,
                    new DatePickerDialog.OnDateSetListener() {
                        @Override
                        public void onDateSet(DatePicker view, int yy, int mm, int dd) {
                            Time selectedTime = new Time();
                            mSelectedYear = yy;
                            mSelectedMonth = mm;
                            mSelectedDay = dd;
                            selectedTime.set(0, mSelectedMinutes, mSelectedHours, mSelectedDay, mSelectedMonth,
                                    mSelectedYear);
                            if (Time.compare(selectedTime, dtNow) <= 0) {
                                mPastDateSelected = true;
                            } else {
                                mPastDateSelected = false;
                            }
                            updateBtnText(selectedTime, false, context);
                        }
                    }, mSelectedYear, mSelectedMonth, mSelectedDay);
            datePickerDialog.show();
        }
    });
    mDialog.show();
}

From source file:com.example.rapha.transpotsystem.RegisterActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_register);
    Log.d(TAG, "onCreate() called");

    name = (EditText) findViewById(R.id.name);
    phone = (EditText) findViewById(R.id.telephone);
    place = (EditText) findViewById(R.id.place);
    address = (EditText) findViewById(R.id.address);
    identification = (EditText) findViewById(R.id.identification);
    vehicle = (Spinner) findViewById(R.id.vehicle);

    dateBorn = (TextView) findViewById(R.id.dateBorn);
    certificateStart = (TextView) findViewById(R.id.certificateStart);
    certificateEnd = (TextView) findViewById(R.id.certificateEnd);

    choosePhoto = (ImageButton) findViewById(R.id.choose_photo);
    choose_license = (ImageButton) findViewById(R.id.choose_license);
    choose_qualification = (ImageButton) findViewById(R.id.choose_qualification);
    choose_identification = (ImageButton) findViewById(R.id.choose_identification);

    ve = (String) vehicle.getSelectedItem();

    Button submit = (Button) findViewById(R.id.VerifySubmit);
    submit.setOnClickListener(new View.OnClickListener() {
        @Override/* w  w w. j  a v  a  2  s  .  c o  m*/
        public void onClick(View v) {

            JiaShiYuan jiashiyuan = new JiaShiYuan();

            jiashiyuan.setJiashiyuanxingming(name.getText().toString());
            jiashiyuan.setDianhua(phone.getText().toString());
            jiashiyuan.setJiguan(place.getText().toString());
            jiashiyuan.setDizhi(address.getText().toString());
            jiashiyuan.setShenfenzhenghao(identification.getText().toString());
            jiashiyuan.setZhunjiachexing(ve);
            jiashiyuan.setChushengriqi(dateBorn.getText().toString());
            jiashiyuan.setChucilingzhengriqi(certificateStart.getText().toString());
            jiashiyuan.setJiashizhengnianshenriqi(certificateEnd.getText().toString());

            if (TextUtils.isEmpty(name.getText().toString())) {
                name.setError("???");
            } else if (TextUtils.isEmpty(phone.getText().toString())) {
                phone.setError("??");
            } else if (TextUtils.isEmpty(place.getText().toString())) {
                place.setError("??");
            } else if (TextUtils.isEmpty(address.getText().toString())) {
                address.setError("??");
            } else if (TextUtils.isEmpty(identification.getText().toString())) {
                identification.setError("??");
            } else if (TextUtils.isEmpty(dateBorn.getText().toString())) {
                dateBorn.setError("");
            } else if (TextUtils.isEmpty(certificateStart.getText().toString())) {
                certificateStart.setError("");
            } else if (TextUtils.isEmpty(certificateEnd.getText().toString())) {
                certificateEnd.setError("");
            } else {

                new VerifyTask(jiashiyuan).execute(); //????

            }

        }
    });

    phone.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) {
                new QueryUser(phone.getText().toString()).execute();
            }
        }
    });

    identification.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) {
                dateBorn.setText(identification.getText().toString().substring(6, 10) + "-"
                        + identification.getText().toString().substring(10, 12) + "-"
                        + identification.getText().toString().substring(12, 14));
            }
        }
    });

    /* dateBorn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Calendar c=Calendar.getInstance();
            
        new DatePickerDialog(RegisterActivity.this,
                new DatePickerDialog.OnDateSetListener(){
                    @Override
                    public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                        int month=monthOfYear+1;
                        dateBorn.setText(year+"-"+month+"-"+dayOfMonth);
                    }
                },c.get(Calendar.YEAR),c.get(Calendar.MONTH),c.get(Calendar.DAY_OF_MONTH)).show();
    }
     });*/

    certificateStart.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Calendar c = Calendar.getInstance();

            new DatePickerDialog(RegisterActivity.this, new DatePickerDialog.OnDateSetListener() {
                @Override
                public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                    int month = monthOfYear + 1;
                    certificateStart.setText(year + "-" + month + "-" + dayOfMonth);
                }
            }, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)).show();
        }
    });

    certificateEnd.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Calendar c = Calendar.getInstance();

            new DatePickerDialog(RegisterActivity.this, new DatePickerDialog.OnDateSetListener() {
                @Override
                public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                    int month = monthOfYear + 1;
                    certificateEnd.setText(year + "-" + month + "-" + dayOfMonth);
                }
            }, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)).show();
        }
    });

    choosePhoto.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (ContextCompat.checkSelfPermission(RegisterActivity.this,
                    Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
                ActivityCompat.requestPermissions(RegisterActivity.this,
                        new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, 1);
            } else {
                openAlbum(CHOOSE_PHOTO);
            }
        }
    });

    choose_license.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (ContextCompat.checkSelfPermission(RegisterActivity.this,
                    Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
                ActivityCompat.requestPermissions(RegisterActivity.this,
                        new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, 1);
            } else {
                openAlbum(CHOOSE_LICENSE);
            }
        }
    });

    choose_qualification.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (ContextCompat.checkSelfPermission(RegisterActivity.this,
                    Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
                ActivityCompat.requestPermissions(RegisterActivity.this,
                        new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, 1);
            } else {
                openAlbum(CHOOSE_QUALIFICATION);
            }
        }
    });

    choose_identification.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (ContextCompat.checkSelfPermission(RegisterActivity.this,
                    Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
                ActivityCompat.requestPermissions(RegisterActivity.this,
                        new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, 1);
            } else {
                openAlbum(CHOOSE_IDENTIFIACTION);
            }
        }
    });

}

From source file:com.metinkale.prayerapp.vakit.fragments.MainFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {

    case R.id.notification:
        Fragment frag = getActivity().getSupportFragmentManager().findFragmentByTag("notPrefs");
        if (frag == null) {
            ((Main) getActivity()).setFooterText("", false);
            getActivity().getSupportFragmentManager().beginTransaction()
                    .add(R.id.fragContainer, NotificationPrefs.create(mTimes), "notPrefs")
                    .commitAllowingStateLoss();
        } else {/* ww  w . j a  va2 s.c o m*/
            ((Main) getActivity()).setFooterText(getString(R.string.monthly), true);
            getActivity().getSupportFragmentManager().beginTransaction().remove(frag).commitAllowingStateLoss();

        }

        break;
    case R.id.export:
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle(R.string.export).setItems(new CharSequence[] { "CSV", "PDF" },
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, final int which) {

                        long minDate = 0;
                        long maxDate = Long.MAX_VALUE;
                        if (mTimes instanceof WebTimes) {
                            minDate = ((WebTimes) mTimes).getFirstSyncedDay().toDateTimeAtCurrentTime()
                                    .getMillis();
                            maxDate = ((WebTimes) mTimes).getLastSyncedDay().toDateTimeAtCurrentTime()
                                    .getMillis();
                        }
                        final LocalDate ld = LocalDate.now();
                        final long finalMaxDate = maxDate;
                        DatePickerDialog dlg = new DatePickerDialog(getActivity(),
                                new DatePickerDialog.OnDateSetListener() {
                                    @Override
                                    public void onDateSet(DatePicker datePicker, int y, int m, int d) {
                                        final LocalDate from = new LocalDate(y, m + 1, d);
                                        DatePickerDialog dlg = new DatePickerDialog(getActivity(),
                                                new DatePickerDialog.OnDateSetListener() {
                                                    @Override
                                                    public void onDateSet(DatePicker datePicker, int y, int m,
                                                            int d) {
                                                        final LocalDate to = new LocalDate(y, m + 1, d);
                                                        try {
                                                            export(which, from, to);
                                                        } catch (IOException e) {
                                                            e.printStackTrace();
                                                            Crashlytics.logException(e);
                                                            Toast.makeText(getActivity(), R.string.error,
                                                                    Toast.LENGTH_SHORT).show();
                                                        }
                                                    }
                                                }, ld.getYear(), ld.getMonthOfYear() - 1, ld.getDayOfMonth());
                                        DateTime startDate = DateTime.now().withDate(y, m + 1, d);
                                        long start = startDate.getMillis();
                                        dlg.getDatePicker().setMinDate(start);
                                        if (which == 1)
                                            dlg.getDatePicker().setMaxDate(
                                                    Math.min(finalMaxDate, startDate.plusDays(31).getMillis()));
                                        else
                                            dlg.getDatePicker().setMaxDate(finalMaxDate);
                                        dlg.setTitle(R.string.to);
                                        dlg.show();

                                    }
                                }, ld.getYear(), ld.getMonthOfYear() - 1, ld.getDayOfMonth());
                        dlg.getDatePicker().setMinDate(minDate);
                        dlg.getDatePicker().setMaxDate(maxDate);
                        dlg.setTitle(R.string.from);
                        dlg.show();
                    }
                });
        builder.show();
        break;
    case R.id.refresh:
        if (mTimes instanceof WebTimes) {
            ((WebTimes) mTimes).syncAsync();
        }
        break;

    case R.id.share:
        String txt = getString(R.string.shareTimes, mTimes.getName()) + ":";
        LocalDate date = LocalDate.now();
        String[] times = { mTimes.getTime(date, 0), mTimes.getTime(date, 1), mTimes.getTime(date, 2),
                mTimes.getTime(date, 3), mTimes.getTime(date, 4), mTimes.getTime(date, 5) };
        for (int i = 0; i < times.length; i++) {
            txt += "\n   " + Vakit.getByIndex(i).getString() + ": " + times[i];
        }

        Intent sharingIntent = new Intent(Intent.ACTION_SEND);
        sharingIntent.setType("text/plain");
        sharingIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name));
        sharingIntent.putExtra(Intent.EXTRA_TEXT, txt);
        startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.share)));

    }
    return super.onOptionsItemSelected(item);
}

From source file:com.cachirulop.moneybox.activity.MovementDetailActivity.java

/**
 * Handler for the change get date button
 * //ww w.java2s  .c o  m
 * @param v
 *            view that launch the event
 */
public void onChangeGetDateClick(View v) {
    Calendar cal;
    DatePickerDialog dlg;
    DatePickerDialog.OnDateSetListener ld;

    cal = Calendar.getInstance();

    ld = new DatePickerDialog.OnDateSetListener() {
        public void onDateSet(DatePicker view, int year, int month, int day) {
            onGetDateSet(view, year, month, day);
        }
    };

    cal.setTime(_movement.getGetDate());

    dlg = new DatePickerDialog(this, ld, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH),
            cal.get(Calendar.DAY_OF_MONTH));
    dlg.show();
}

From source file:net.evecom.android.PublicOpinionLookActivity.java

/**
 * //from  w  w w  .j av  a2  s.c  o m
 */
private void listener() {

    lysjButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Dialog dialog = new AlertDialog.Builder(PublicOpinionLookActivity.this).setTitle("")
                    .setPositiveButton("", new DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            Dialog dialog1 = new DatePickerDialog(PublicOpinionLookActivity.this,
                                    new DatePickerDialog.OnDateSetListener() {

                                        public void onDateSet(DatePicker view, int year, int monthOfYear,
                                                int dayOfMonth) {
                                            String MonthOfYear = "";
                                            String DayOfMonth = "";
                                            years = year;
                                            month = monthOfYear + 1;
                                            day = dayOfMonth;
                                            if (monthOfYear < 9) {

                                                MonthOfYear = "0" + month;
                                            } else {
                                                MonthOfYear = "" + month;
                                            }
                                            if (dayOfMonth < 9) {
                                                DayOfMonth = "0" + dayOfMonth;
                                            } else {
                                                DayOfMonth = "" + dayOfMonth;
                                            }
                                            lysjButton.setText("" + year + "-" + MonthOfYear + "-" + DayOfMonth
                                                    + " " + hours + ":" + minutes + ":"
                                                    + calendar.get(Calendar.SECOND));
                                            // lysjButton.setText("" + years
                                            // + "-"
                                            // + month
                                            // + "-" + day +" "
                                            // + hours +":"
                                            // + minutes+":"
                                            // +
                                            // calendar.get(Calendar.SECOND));
                                            lysj = years + "-" + month + "-" + day + "+" + hours + "%3A"
                                                    + minutes + "%3A" + calendar.get(Calendar.SECOND);
                                        }
                                    }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
                                    calendar.get(Calendar.DAY_OF_MONTH));// 
                            dialog1.show();
                        }
                    }).setNeutralButton("", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            Dialog dialog2 = new TimePickerDialog(PublicOpinionLookActivity.this,
                                    new TimePickerDialog.OnTimeSetListener() {
                                        public void onTimeSet(TimePicker view, int hour, int minute) {
                                            lysjButton.setText("" + years + "-" + month + "-" + day + " " + hour
                                                    + ":" + minute + ":" + calendar.get(Calendar.SECOND));
                                            hours = hour;
                                            minutes = minute;
                                            lysj = years + "-" + month + "-" + day + "+" + hours + "%3A"
                                                    + minutes + "%3A" + calendar.get(Calendar.SECOND);
                                        }
                                    }, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), true);// 
                            dialog2.show();
                        }
                    }).setNegativeButton("", new DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface dialog, int which) {

                            lysjButton.setText("");

                            lysj = "";

                        }
                    }).show();
        }
    });
    // 
    lylxButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
            Dialog schDia = new AlertDialog.Builder(PublicOpinionLookActivity.this)
                    .setIcon(R.drawable.login_error_icon).setTitle("")
                    .setItems(lylxs, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dia, int which) {
                            lylxButton.setText(lylxs[which]);
                            sourceway = which + 1;
                        }
                    }).setNegativeButton("", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dia, int which) {
                            dia.dismiss();
                        }
                    }).create();
            schDia.show();
        }
    });
}

From source file:com.rsmsa.accapp.ScreenSlidePageFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.vehicle_one, container, false);

    tab_one = (EditText) rootView.findViewById(R.id.dob_one);
    Log.d("vp", "current page " + MainActivity.currentPage);
    Log.d("vp", "tab text " + tab_one.getText());
    /**/*from   w w  w  .  j  ava 2  s  .  c om*/
     * Defining all layout items
     **/

    inputFatal = (EditText) rootView.findViewById(R.id.fatal_edit);
    inputInjuries = (EditText) rootView.findViewById(R.id.injury_edit);
    inputSimple = (EditText) rootView.findViewById(R.id.simple_edit);
    inputNotInjured = (EditText) rootView.findViewById(R.id.not_injured_edit);

    //driver 0ne details
    surname_one = (EditText) rootView.findViewById(R.id.surname_one);
    othernames_one = (EditText) rootView.findViewById(R.id.othernames_one);
    physical_address_one = (EditText) rootView.findViewById(R.id.physical_address_one);
    address_box_one = (EditText) rootView.findViewById(R.id.address_box_one);
    national_id_one = (EditText) rootView.findViewById(R.id.national_id_one);
    phone_no_one = (EditText) rootView.findViewById(R.id.phone_no_one);
    gender = (RadioGroup) rootView.findViewById(R.id.gender);
    RadioButton male = (RadioButton) rootView.findViewById(R.id.male);
    RadioButton female = (RadioButton) rootView.findViewById(R.id.female);
    nationality_one = (EditText) rootView.findViewById(R.id.nationality_one);
    license_one = (EditText) rootView.findViewById(R.id.license_one);
    occupation_one = (EditText) rootView.findViewById(R.id.occupation_one);

    alcohol_edit = (EditText) rootView.findViewById(R.id.alcohol_edit);
    drug_edit = (CheckBox) rootView.findViewById(R.id.drug_edit);
    phone_edit = (CheckBox) rootView.findViewById(R.id.phone_edit);
    seat_belt_edit = (CheckBox) rootView.findViewById(R.id.seat_belt_edit);

    //Vehicle one details
    type_one = (EditText) rootView.findViewById(R.id.type_one);
    registration_number_one = (EditText) rootView.findViewById(R.id.registration_number_one);

    //Vehicle one  Insurance details
    company_one = (EditText) rootView.findViewById(R.id.company_one);
    insurance_type_one = (EditText) rootView.findViewById(R.id.insurance_type_one);
    insurance_phone = (EditText) rootView.findViewById(R.id.insurance_phone);
    policy_period_one = (EditText) rootView.findViewById(R.id.policy_period_one);
    policy_number_one = (EditText) rootView.findViewById(R.id.policy_number_one);
    repair_amount_one = (EditText) rootView.findViewById(R.id.repair_amount_one);

    //Vehicle one  damage details
    vehicle = (EditText) rootView.findViewById(R.id.vehicle_title_edit);
    vehicle_total = (EditText) rootView.findViewById(R.id.vehicle_total_edit);
    infrastructure = (EditText) rootView.findViewById(R.id.infrastructure_edit);
    cost = (EditText) rootView.findViewById(R.id.rescue_cost_edit);

    //Textchange
    inputFatal.addTextChangedListener(new EditTextWatcher(inputFatal));
    inputInjuries.addTextChangedListener(new EditTextWatcher(inputInjuries));
    inputSimple.addTextChangedListener(new EditTextWatcher(inputSimple));
    inputNotInjured.addTextChangedListener(new EditTextWatcher(inputNotInjured));

    surname_one.addTextChangedListener(new EditTextWatcher(surname_one));
    othernames_one.addTextChangedListener(new EditTextWatcher(othernames_one));
    physical_address_one.addTextChangedListener(new EditTextWatcher(physical_address_one));
    address_box_one.addTextChangedListener(new EditTextWatcher(address_box_one));
    national_id_one.addTextChangedListener(new EditTextWatcher(national_id_one));
    phone_no_one.addTextChangedListener(new EditTextWatcher(phone_no_one));
    inputFatal.addTextChangedListener(new EditTextWatcher(inputFatal));
    inputInjuries.addTextChangedListener(new EditTextWatcher(inputInjuries));
    inputSimple.addTextChangedListener(new EditTextWatcher(inputSimple));
    inputNotInjured.addTextChangedListener(new EditTextWatcher(inputNotInjured));
    // gender.addTextChangedListener(new EditTextWatcher(gender));
    nationality_one.addTextChangedListener(new EditTextWatcher(nationality_one));
    license_one.addTextChangedListener(new EditTextWatcher(license_one));
    occupation_one.addTextChangedListener(new EditTextWatcher(occupation_one));

    alcohol_edit.addTextChangedListener(new EditTextWatcher(alcohol_edit));
    //drug_edit.addTextChangedListener(new EditTextWatcher(drug_edit));
    //phone_edit.addTextChangedListener(new EditTextWatcher(phone_edit));
    //seat_belt_edit.addTextChangedListener(new EditTextWatcher(seat_belt_edit));

    type_one.addTextChangedListener(new EditTextWatcher(type_one));
    registration_number_one.addTextChangedListener(new EditTextWatcher(registration_number_one));

    company_one.addTextChangedListener(new EditTextWatcher(company_one));
    insurance_type_one.addTextChangedListener(new EditTextWatcher(insurance_type_one));
    insurance_phone.addTextChangedListener(new EditTextWatcher(insurance_phone));
    policy_period_one.addTextChangedListener(new EditTextWatcher(policy_period_one));
    policy_number_one.addTextChangedListener(new EditTextWatcher(policy_number_one));
    repair_amount_one.addTextChangedListener(new EditTextWatcher(repair_amount_one));

    vehicle.addTextChangedListener(new EditTextWatcher(vehicle));
    vehicle_total.addTextChangedListener(new EditTextWatcher(vehicle_total));
    infrastructure.addTextChangedListener(new EditTextWatcher(infrastructure));
    cost.addTextChangedListener(new EditTextWatcher(cost));

    vehicle_category = (Spinner) rootView.findViewById(R.id.vtype_spinner);

    vehicle_type = (Button) rootView.findViewById(R.id.vehicle_type_select_button);

    cal = Calendar.getInstance();

    day = cal.get(Calendar.DAY_OF_MONTH);

    month = cal.get(Calendar.MONTH);

    year = cal.get(Calendar.YEAR);

    pickDate = (Button) rootView.findViewById(R.id.date_picker);
    pickDate.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(), datePickerListener, year,
                    month, day);
            datePickerDialog.show();
        }
    });

    List<String> vehicle_category_list = new ArrayList<String>();
    vehicle_category_list.add("Private");
    vehicle_category_list.add("Commercial");
    vehicle_category_list.add("Government");
    vehicle_category_list.add("Emergency");
    vehicle_category_list.add("Passenger Service Vehicles");

    vehicle_category.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            selectedSpinner = i;
            if (i == 0) {
                selectedSpinner = 234;
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {

        }
    });

    vehicle_type.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent(getActivity(), VehicleType.class);
            intent.putExtra("category", selectedSpinner + "");
            startActivity(intent);
        }
    });

    ArrayAdapter<String> atc_adapter = new ArrayAdapter<String>(getActivity(),
            android.R.layout.simple_spinner_item, vehicle_category_list);
    atc_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    vehicle_category.setAdapter(atc_adapter);

    return rootView;
}

From source file:org.mifos.androidclient.templates.OperationFormActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    Dialog dialog;//ww w . java 2  s  .  c o m
    switch (id) {
    case DATE_DIALOG_ID:
        Calendar today = Calendar.getInstance();
        return new DatePickerDialog(this, this, today.get(Calendar.YEAR), today.get(Calendar.MONTH),
                today.get(Calendar.DAY_OF_MONTH));
    default:
        dialog = null;
    }
    return dialog;
}

From source file:net.evecom.androidecssp.activity.event.ContinueAddActivity.java

/**
 * /*from   w  w w  . j  a  va 2 s  .com*/
 * 
 * 
 * @author Stark Zhou
 * @created 2015-12-30 2:44:26
 */
private void init() {
    initGallery();
    clearLocation();
    clearFilesRecord();
    calendar = Calendar.getInstance();
    typeValueKeyMap.put("", "1");
    typeValueKeyMap.put("", "2");
    happenAreaBlock = (RelativeLayout) findViewById(R.id.happen_area_block);
    happenAreaBlock.setVisibility(View.GONE);
    happenDateBlock = (RelativeLayout) findViewById(R.id.happen_date_block);
    happenDateBlock.setVisibility(View.GONE);
    happenAddrBlock = (RelativeLayout) findViewById(R.id.happen_addr_block);
    happenAddrBlock.setVisibility(View.GONE);
    reportTime = (TextView) findViewById(R.id.continue_reporttime_add);
    reportDate = (TextView) findViewById(R.id.continue_reportdate_add);
    eventName = (TextView) findViewById(R.id.continue_eventname_add);
    eventName.setText(eventInfo.getStr("eventname"));
    continueMonitor = (TextView) findViewById(R.id.continue_monitor_add);
    continueName = (EditText) findViewById(R.id.continue_name_add);
    happenTime = (TextView) findViewById(R.id.happen_time_add);
    happenDate = (TextView) findViewById(R.id.happen_date_add);
    continueType = (TextView) findViewById(R.id.continue_type_add);
    continueType.setText("");
    continueArea = (TextView) findViewById(R.id.continue_area_add);
    continueAddr = (EditText) findViewById(R.id.continue_addr_add);
    continueDept = (TextView) findViewById(R.id.continue_dept_add);
    continueReporter = (EditText) findViewById(R.id.continue_reporter_add);
    String userName = ShareUtil.getString(getApplicationContext(), "PASSNAME", "usernameCN", "0");
    continueReporter.setText(userName);
    continueTel = (EditText) findViewById(R.id.continue_tel_add);
    continueContent = (EditText) findViewById(R.id.continue_content_add);
    continueStep = (EditText) findViewById(R.id.continue_step_add);
    continueRemark = (EditText) findViewById(R.id.continue_remark_add);
    happenDate.setText(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-"
            + calendar.get(Calendar.DAY_OF_MONTH));
    happenTime.setText(calendar.get(Calendar.HOUR_OF_DAY) + ":" + calendar.get(Calendar.MINUTE));
    reportDate.setText(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-"
            + calendar.get(Calendar.DAY_OF_MONTH));
    reportTime.setText(calendar.get(Calendar.HOUR_OF_DAY) + ":" + calendar.get(Calendar.MINUTE));

    // 
    happenDate.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
            calendar = Calendar.getInstance();
            happenDate.setBackgroundResource(R.drawable.time_btn_press);
            new DatePickerDialog(ContinueAddActivity.this, new DatePickerDialog.OnDateSetListener() {
                @Override
                public void onDateSet(DatePicker arg0, int year, int monthOfYear, int dayOfMonth) {
                    happenDate.setText("" + year + "-" + (monthOfYear + 1) + "-" + dayOfMonth);
                    happenDate.setBackgroundResource(R.drawable.time_btn);
                }
            }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH))
                    .show();

        }
    });
    happenTime.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
            calendar = Calendar.getInstance();
            happenTime.setBackgroundResource(R.drawable.time_btn_press);
            new TimePickerDialog(ContinueAddActivity.this, new TimePickerDialog.OnTimeSetListener() {
                public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                    happenTime.setText(hourOfDay + ":" + minute);
                    happenTime.setBackgroundResource(R.drawable.time_btn);
                }
            }, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), true).show();

        }
    });

    reportDate.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
            calendar = Calendar.getInstance();
            reportDate.setBackgroundResource(R.drawable.time_btn_press);
            new DatePickerDialog(ContinueAddActivity.this, new DatePickerDialog.OnDateSetListener() {
                @Override
                public void onDateSet(DatePicker arg0, int year, int monthOfYear, int dayOfMonth) {
                    reportDate.setText(year + "-" + (monthOfYear + 1) + "-" + dayOfMonth);
                    reportDate.setBackgroundResource(R.drawable.time_btn);
                }
            }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH))
                    .show();
        }
    });

    reportTime.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
            reportTime.setBackgroundResource(R.drawable.time_btn_press);
            calendar = Calendar.getInstance();
            new TimePickerDialog(ContinueAddActivity.this, new TimePickerDialog.OnTimeSetListener() {
                @Override
                public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                    reportTime.setText(hourOfDay + ":" + minute);
                    reportTime.setBackgroundResource(R.drawable.time_btn);
                }
            }, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), true).show();
        }
    });

}