I wanted to use a function that used a arraylist for multiple types of arraylists, but I don't know how to do that.
ArrayList<TextView> List2 = new ArrayList<>();
ArrayList<View> List1 = new ArrayList<>();
ChangeTextSize(List1);
ChangeTextSize(List2);
public void ChangeTextSize(ArrayList List){
for (int i = 0; i < List.size(); i++){
List.get(i).setTextSize(TypedValue.COMPLEX_UNIT_SP,15);
}
}
-Edit: The function is meant for any view. I'm now aware that setTextSize isn't allowed for view.
Viewdoesn't have asetTextSizemethod, it wouldn't make sense. However, if you change the method call topublic void ChangeTextSize(ArrayList<TextView> List){you'd be able to passList1with less issues