jeudi 25 juillet 2019

How do I check the visibillitiy of an element in a if-statement?

im trying to check onCancelListener of my timerpicker-dialog the visibility of an radio-button (rdi_1), and want to setChecked(true) if visibility is VISIBLE.

timePickerDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
                        @Override
                        public void onCancel(DialogInterface dialogInterface) {

                            if (rdi_1.getVisibility() == View.VISIBLE) {
                                rdi_now.setChecked(true); }
                            rdi_2.setChecked(false);
                        }
                    }

Only rdi_2 gets unchecked

Aucun commentaire:

Enregistrer un commentaire