Code example for Button

Methods: setEnabled

0
 
    public void afterTextChanged(Editable s) {
        if (mDeviceNameUpdated) {
            // Device name changed by code; disable Ok button until edited by user 
            mDeviceNameUpdated = false;
            mOkButton.setEnabled(false);
        } else { 
            mDeviceNameEdited = true;
            if (mOkButton != null) {
                mOkButton.setEnabled(s.length() != 0 && !(s.toString().trim().isEmpty()));
            } 
        } 
    } 
 
    /* Not used */ 
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    } 
 
    /* Not used */ 
    public void onTextChanged(CharSequence s, int start, int before, int count) {
Contextual code suggestions in your IDE  Get Codota for Java