Code example for CheckBox

Methods: isCheckedsetChecked

0
    public FileItemInfoLayout(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    } 
 
    public void toggle() { 
        setChecked(!mCheckbox.isChecked());
    } 
 
    /* (non-Javadoc) 
     * @see android.view.View#onFinishInflate() 
     */ 
    @Override 
    protected void onFinishInflate() { 
        super.onFinishInflate(); 
        mFileNameView = (TextView) findViewById(R.id.misc_filename);
        mFileSizeView = (TextView) findViewById(R.id.misc_filesize);
        mCheckbox = (CheckBox) findViewById(R.id.misc_checkbox);
    } 
 
    public void setFileName(String fileName) {
        mFileNameView.setText(fileName.substring(sLengthExternalStorageDirPrefix));
    } 
 
    public void setFileSize(String filesize) {
        mFileSizeView.setText(filesize);
    } 
 
    @ViewDebug.ExportedProperty 
    public boolean isChecked() { 
        return mCheckbox.isChecked();
    } 
 
    public CheckBox getCheckBox() {
        return mCheckbox;
    } 
 
    /** 
     * <p>Changes the checked state of this text view.</p> 
     * 
     * @param checked true to check the text, false to uncheck it 
     */ 
    public void setChecked(boolean checked) {
        mCheckbox.setChecked(checked);
    } 
} 
Connect your IDE to all the code out there  Get Codota for Java