Supposing your first ImageView
would have the id: firstimage
, try with:
TabHost th = (TabHost) findViewById(android.R.id.tabhost);
ImageView iv = (ImageView) th.getCurrentView().findViewById(R.id.firstimage);
Question
I have a TabWidget that holds a set of ImageViews. The FrameLayout the TabWidget uses to display content is inside a HorizontalScrollView so multiple ImageViews can be seen via scroll.
I need to interact with the items within the tab content. More specifically, I have an array of elements. I need to get the children of the innermost FrameLayout and cycle through them to compare their tag to the the elements in my array. If there is a match I need to change their background. Looping through the children and changing the background, I know how to do. I'm just having issues getting to the ImageViews so I can cycle through them.
to note: I'm working with a layout I've inherited and I don't really have time to "redo" anything unless I really have to
Solution
Supposing your first ImageView
would have the id: firstimage
, try with:
TabHost th = (TabHost) findViewById(android.R.id.tabhost);
ImageView iv = (ImageView) th.getCurrentView().findViewById(R.id.firstimage);