My problem is accessing dynamically added component. If we assign id’s of views via xml (such as android:id="@+id/xyz", we can reach this view by findViewById(R.id.xyz). However, I want to assign id dynamically, because I will use a ListView or a TableLayout and I will be adding rows dynamically from database.
Also, I need to know which checkboxes are checked, therefore according to me I should reach the checkboxes by id. I know setId method, but it gets integer value and for example I want to assign ids for my checkboxes like checkbox1, checkbox2, … checkbox100. And then I want to control for example in a for loop(from 1 to 100) if checkbox1, …, checkbox100 are checked.
How can I manage this?
Call
setId()on eachCheckBox, supplying your own number.