I'm trying to iterate through all R.id
to find all ImageView
objects and change there properties. but Android studio gives me an error.
here is code
public void initializeChipsViewholdersArray (){
for (int i = 1; i<10; i ++){
String viewholderName = "chip_00"+i;
int id_2 = R.id.class.getFields(viewholderName).getInt(0);//erorr here
ImageView chipViewholder= (ImageView)findViewById(id);
chipViewholder.setVisibility(View.INVISIBLE);
}
here is error
Error:(28, 33) error: method getFields in class Class cannot be applied to given types; required: no arguments found: String reason: actual and formal argument lists differ in length where T is a type-variable: T extends Object declared in class Class
The solution I choose has been discussed here How do I iterate through the id properties of R.java class?