mardi 20 octobre 2015

How to pass the values while check box is unchecked

I have 3 check boxes..I have added click listener for each check boxes..based on the check box click i had set the values inside click listener...After adding the check box click,there will be possibility to uncheck it while updating the check box...

While clicking the check box i am setting isSelected =1...Like the way i need to set isSelected =0 while it is unchecked...How is it possible..Please help me to find out

This is my check box click listener1

checkBox_onEventDay.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {

                if (((CheckBox) v).isChecked()) {
                    response = 1;
                    try {
                        //Here we are getting the date from btn_Date(date picker)
                        //date and time format changed here
                        String eventDate = btn_Date.getText().toString();
                        DateFormat date = new SimpleDateFormat("dd-M-yyyy");
                        Date date1 = date.parse(eventDate);
                        DateFormat convertDate = new SimpleDateFormat(" dd.MM.yyyy");
                        eventDate = convertDate.format(date1);
                        eventMO.setEventDate(eventDate);
                        //here we are setting event date as reminder date..
                        //Because it is on event day checkbox
                        reminderDate = eventDate;
                        eventReminderDaysDetails(response, reminderDate);
                        Toast.makeText(OccasionActivity.this,
                                "Checked", Toast.LENGTH_LONG).show();


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

            }
        });




Aucun commentaire:

Enregistrer un commentaire