I am adding views to a layout at run time. thee views are like so:
<LinearLayout android:id="@+id/ll1">
<LinearLayout android:id="@+id/ll2" >
<ImageView android:id="@+id/iv1" />
<TextView android:id="@+id/tv1"/>
<ImageView android:id="@+id/iv2"/>
</LinearLayout>
(I took a lot out to make it simple)
Now in code I am adding any number of these to a layout. How then do I access the ImageViews and TextViews in each addition of this view?
Currently I have this complicated way going through each child and doing a
if (View instanceof ImageView)
if I were to call parentView.getChildAt(0)
(where parent view is ll2) would this always return iv1? and at "1" would this always return tv1?
Then I have been storing these objects in a vector of itself, to call on them later.
Is there an easier way of doing this? Like when I first add the whole thing, is there a way I can just set the sources of the image views, and set the text of the textviews without having to go and find them this way?