Last active
June 2, 2021 16:47
-
-
Save maxmumford/7695646 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String[] info = new String[2]; | |
info[0] = "info 1"; | |
info[1] = "info 2"; | |
LayoutInflater layoutInflator = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); | |
LinearLayout insertPoint = (LinearLayout) findViewById(R.id.linearLayout1); | |
List views = new ArrayList(); | |
for(int i=0; i < info.length; i++){ | |
View view = layoutInflator.inflate(R.layout.linearLayout1, null); | |
TextView textView = (TextView) view.findViewById(R.id.textView1); | |
textView.setText(info[i]); | |
views.add(view); | |
} | |
for(int i = 0; i < views.size(); i++) | |
insertPoint.addView(views.get(i)); |
insertPoint.addView(views.get(i));
getting error is Required type:View
Provided:Object
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to obtain a specific view if you add views in loop? i have the same code in my project but cant return a specific view value on click button inside this view