Android Checkable - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Checkable class.

This code example shows how to use the following methods:isChecked
        child = (Checkable) getChildAt(CHECKABLE_CHILD_INDEX);
    } 
 
    @Override 
    public boolean isChecked() { 
        return child.isChecked(); 
    } 
 
    @Override 
    public void setChecked(boolean checked) {
        child.setChecked(checked);
    } 
 
    @Override 
    public void toggle() { 
        child.toggle();
    } 
     
} 
7
CodeRank
This code example shows how to use the following methods:setChecked, setOnCheckedChangeListener, setText
    { 
        return ((Tag) getItem(position)).getTag().hashCode();
    } 
 
    public void initTagCheckbox(Tag tag, CheckBox checkBox) {
        checkBox.setText(tag.getTag());
        checkBox.setOnCheckedChangeListener(null);
        checkBox.setChecked(isChecked(tag.getTag()));
        checkBox.setOnCheckedChangeListener(this);
    } 
 
    @Override 
    public void onCheckedChanged(CompoundButton buttonView,
            boolean isChecked) {
 
        String text = (String) buttonView.getText();
        if (isChecked)
            checkedTags.add(text);
        else 
            checkedTags.remove(text);
7
CodeRank
This code example shows how to use the following methods:isChecked
        child = (Checkable) getChildAt(CHECKABLE_CHILD_INDEX);
    } 
 
    @Override 
    public boolean isChecked() { 
        return child.isChecked();
    } 
 
    @Override 
    public void setChecked(boolean checked) {
        child.setChecked(checked);
    } 
 
    @Override 
    public void toggle() { 
        child.toggle();
    } 
 
} 
6
CodeRank
This code example shows how to use the following methods:setChecked, setPadding
 
          /* First CheckBox and the Text to the right (horizontal), 
           * not above and below (vertical) */ 
          this.setOrientation(HORIZONTAL);
          mCheckBoxText = aCheckBoxifiedText;
          mCheckBox = new CheckBox(context);
          mCheckBox.setPadding(0, 0, 20, 0); // 5px to the right
           
          /* Set the initial state of the checkbox. */ 
          mCheckBox.setChecked(aCheckBoxifiedText.getChecked());
           
           
          /* At first, add the CheckBox to ourself 
           * (! we are extending LinearLayout) */ 
          addView(mCheckBox,  new LinearLayout.LayoutParams(
                    LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
           
          mText = new TextView(context);
          mText.setText(aCheckBoxifiedText.getText());
          mText.setTextColor(getResources().getColor(android.R.color.black));
5
CodeRank
This code example shows how to use the following methods:setChecked
		 
		//remove all child views from this row 
		removeAllViews();
		 
		//add the selected checkbox 
		selectedBox = new CheckBox(getContext());
		selectedBox.setChecked(download.isSelected());
		 
		//add the url 
		TextView urlBox = new TextView(getContext());
		urlBox.setText(download.getTheURL().toString());
		 
		//add the status of the download 
		TextView statusBox = new TextView(getContext());
		//depending on the text, set colour 
 
		if(download.getStatus().equals("pending") || 
				download.getStatus().equals("in progress")){
			statusBox.setTextColor(Color.YELLOW);
		}else if(download.getStatus().equals("complete")){
5
CodeRank
This code example shows how to use the following methods:isChecked
		} 
	} 
	@Override 
	public boolean isChecked() { 
		if(mCheckable != null){
			return mCheckable.isChecked();
		} 
		return false; 
	} 
	@Override 
	public void setChecked(boolean checked) {
		if(mCheckable != null){
			mCheckable.setChecked(checked);
		} 
	} 
	@Override 
	public void toggle() { 
		if(mCheckable != null){
			mCheckable.toggle();
		} 
4
CodeRank
This code example shows how to use the following methods:setChecked
	@Override 
	public void setChecked(boolean checked) {
		checkable = (Checkable) findViewById(checkableId);
		if(checkable == null)
			return; 
		checkable.setChecked(checked);
	} 
 
	@Override 
	public void toggle() { 
		checkable = (Checkable) findViewById(checkableId);
		if(checkable == null)
			return; 
		checkable.toggle();
	} 
	 
} 
4
CodeRank
This code example shows how to use the following methods:isChecked
		} 
	} 
	@Override 
	public boolean isChecked() { 
		if(mCheckable != null){
			return mCheckable.isChecked();
		} 
		return false; 
	} 
	@Override 
	public void setChecked(boolean checked) {
		if(mCheckable != null){
			mCheckable.setChecked(checked);
		} 
	} 
	@Override 
	public void toggle() { 
		if(mCheckable != null){
			mCheckable.toggle();
		} 
4
CodeRank
This code example shows how to use the following methods:setChecked
		return mCheckableView.isChecked();
	} 
 
	@Override 
	public void setChecked(boolean checked) {
		mCheckableView.setChecked(checked);
	} 
 
	@Override 
	public void toggle() { 
		mCheckableView.toggle();
	} 
	 
	@Override 
	protected void onFinishInflate() { 
		super.onFinishInflate(); 
 
		mCheckableView = (Checkable) this.findViewById(R.id.checkbox);
	} 
 
4
CodeRank
This code example shows how to use the following methods:setChecked
		return mCheckableView.isChecked();
	} 
 
	@Override 
	public void setChecked(boolean checked) {
		mCheckableView.setChecked(checked);
	} 
 
	@Override 
	public void toggle() { 
		mCheckableView.toggle();
	} 
	 
	@Override 
	protected void onFinishInflate() { 
		super.onFinishInflate(); 
 
		mCheckableView = (Checkable) this.findViewById(R.id.checkbox);
	} 
 
4
CodeRank

Related Android Checkable Questions & Answers:

See Code Examples for Android Checkable Methods: