0

I have a CheckBox in my app which sets the visibility of the TimePicker and the DatePicker! The code looks something like this

public void onCheckBClicked(View v) {

    boolean checked = ((CheckBox) v).isChecked();

    if(checked==false)
    {
        mDateButton.setVisibility(View.INVISIBLE);
        mTimeButton.setVisibility(View.INVISIBLE);

    }
    else
    {
        mDateButton.setVisibility(View.VISIBLE);
        mTimeButton.setVisibility(View.VISIBLE);

    }

  }

This works perfectly fine! But the prob is, The time and date are by default set to the time and date on my phone! I want blank values on the TimePicker and DatePicker! How can I do that??

naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259
  • what do you mean by blank values? there has to be something in them.. is there any other value you want to set? – Royi Jan 13 '13 at 10:41
  • ok! See my app is a to-do list app, If the user chooses not to give a reminder to a certain task then there is no need for the reminder to be added! Right now my app adds reminders to every task! So I put a checkBox in my app that says "add reminder to this task" if the checkBox is checked then the date and time picker appear and the user sets the date and time, but if the checkBox is unchecked, it doesn't show the date and time pickers but by Default adds a reminder of the current time and date! how do solve this? – user1949861 Jan 13 '13 at 10:54
  • the timepicker gives a long var to represent the time - just put -1 for the time when the checkbox is not checked - and if the time is -1 don't add reminder – Royi Jan 13 '13 at 11:06
  • private TimePickerDialog showTimePicker() { TimePickerDialog timePicker = new TimePickerDialog(this, new TimePickerDialog.OnTimeSetListener() { public void onTimeSet(TimePicker view, int hourOfDay, int minute) { mCalendar.set(Calendar.HOUR_OF_DAY, hourOfDay); mCalendar.set(Calendar.MINUTE, minute); updateTimeButtonText(); } }, mCalendar.get(Calendar.HOUR_OF_DAY), mCalendar.get(Calendar.MINUTE), true); return timePicker; } where do I make the change,tell me? – user1949861 Jan 13 '13 at 11:23

0 Answers0