I need to iterate through a list of variable names that are stored in a text file, store each as a TextView, and call methods on each one. Is there any way to do this? I have tried using the code provided in Is there any way to loop though variable names?, but TextView is not a class.
void populate2(){
for(int i = 0; i < taskArray3.size(); i++){
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.linlayout);
ArrayList<String> a = FileHelper.readData() // Gets list of variable names from text list stored in FileHelper
TextView txt1-20? = new TextView(this); // want to now iterate through all names in the list, don't know how.
final float scale = this.getResources().getDisplayMetrics().density;
int pixels = (int) (49 * scale + 0.5f);
ViewGroup.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, pixels);
txt1.setLayoutParams(params);
txt1.setText(taskArray3.get(i));
txt1.setGravity(Gravity.CENTER);
linearLayout.addView(txt1);
}
}