I have a custom attribute in a subview class defined in XML file:
<com.mysubView>
android:id="@+id/board"
android:layout_height="match_parent"
android:layout_width="match_parent"
cus:Count="0"
/>
I would like to be able to access it main_activity.java to set a value to Count like this:
findViewById(R.id.board).setCount(10);
Is it possible?
Note: attrs.xml is already populated with corresponding stylable.
Here is a related article on custom attributes Here is constructor to the sub-view class:
public MySubView (Context c, AttributeSet attrs) {
super(c, attrs);
}