mardi 2 août 2016

How to get Focus on EditText after checked CheckBox?

When user launch app then I don't want to allow user to edit in EditText. Now what I want that when user click on checkBox then user able to edit Edittext but below is my code and when I checked the checkbox it is not giving focus. how can I achieve this ?

cbIsGap.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {

                    txtConsAcNo.setFocusable(true);
                    txtConsAcNo.setClickable(true);
                    txtMeterSrMo.setClickable(true);
                    txtMobile.setFocusable(true);


                }else {


                    txtConsAcNo.setFocusable(false);
                    txtConsAcNo.setClickable(false);
                    txtMeterSrMo.setFocusable(false);
                    txtMeterSrMo.setClickable(false);

                }
            }
        });




Aucun commentaire:

Enregistrer un commentaire