TimePicker Dialog from clicking EditText

eReminderTime.setText( "" + selectedHour + ":" + selectedMinute);

Your missing a + between "" and selected hour, setText methods only take a single string, so you need to concatenate all the parts (the first quotes are likely unnecessary).

eReminderTime.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            // TODO Auto-generated method stub
            Calendar mcurrentTime = Calendar.getInstance();
            int hour = mcurrentTime.get(Calendar.HOUR_OF_DAY);
            int minute = mcurrentTime.get(Calendar.MINUTE);
            TimePickerDialog mTimePicker;
            mTimePicker = new TimePickerDialog(AddReminder.this, new TimePickerDialog.OnTimeSetListener() {
                public void onTimeSet(TimePicker timePicker, int selectedHour, int selectedMinute) {
                    eReminderTime.setText( selectedHour + ":" + selectedMinute);
            }, hour, minute, true);//Yes 24 hour time
            mTimePicker.setTitle("Select Time");


That should fix your second error, you weren’t providing the last parameter.
TimePickerDialog Constructors

Leave a Comment