Code example for EditText

Methods: requestFocussetEnabled

0
        final EditText emailEditText = (EditText) findViewById(R.id.email);
 
        sendReportCheckBox.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() {
            @Override 
            public void onCheckedChanged(CompoundButton checkbox, boolean isChecked) {
                commentsEditText.setEnabled(isChecked);
                commentsEditText.requestFocus();
 
                includeUrlCheckBox.setEnabled(isChecked);
                allowContactCheckBox.setEnabled(isChecked);
                emailEditText.setEnabled(isChecked && allowContactCheckBox.isChecked());
            } 
        }); 
 
        allowContactCheckBox.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() {
            @Override 
            public void onCheckedChanged(CompoundButton checkbox, boolean isChecked) {
                // We need to check isEnabled() here because this listener is 
                // fired on rotation -- even when the checkbox is disabled. 
                emailEditText.setEnabled(checkbox.isEnabled() && isChecked);
Experience pair programming with AI  Get Codota for Java