Skip to content

Commit

Permalink
Add isChecked() to retrieve checked state of child view.
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3z committed Jul 31, 2018
1 parent 1c6032e commit b7d7c60
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public void setOnHierarchyChangeListener(OnHierarchyChangeListener listener) {
mPassThroughListener.mOnHierarchyChangeListener = listener;
}

public boolean isChecked(int childId) {
View child = findViewById(childId);
return child instanceof Checkable && ((Checkable) child).isChecked();
}

protected void setCheckedStateForView(int viewId, boolean checked) {
View target = findViewById(viewId);
if (target != null && target instanceof Checkable) {
Expand Down

0 comments on commit b7d7c60

Please sign in to comment.