Android - Inflating views and adding to ViewAnimator - what to set as root

I have an \[code\]XML LinearLayout\[/code\] which contains a \[code\]ViewAnimator\[/code\]. I want to dynamically add views to this \[code\]ViewAnimator\[/code\]. The views I want to add I have in XML called \[code\]describe_inner_view\[/code\]. In my code I am inflating these \[code\]InnerViews\[/code\] and in the \[code\]inflate()\[/code\] method, putting the root parameter as the reference to the \[code\]ViewAnimator\[/code\]. However, I am not able to set the index of these views in the \[code\]ViewAnimator\[/code\] and so it is not displaying properly when I run - when I swipe the second view has none of the proper attributes set (for example the \[code\]tv_itemName\[/code\] from the code below isn't set properly).Is there a way to inflate and add to the \[code\]ViewAnimator\[/code\] whilst specifying the index?Thanks!Here is the relevant code:\[code\]for (int i = 0; i < descriptionItems.length; i++) { ViewAnimator va = (ViewAnimator) findViewById(R.id.va_describeVa); View ll = View.inflate(this, R.layout.describe_inner_view, va); TextView tv_itemName = (TextView) ll.findViewById(R.id.describe_item_name); tv_itemName.setText(descriptionItems.getItem().getName());}\[/code\]
 
Back
Top