Trying to access imageViews that reside in a TableLayout - Android -


i have tablelayout has 3 tablerows , within rows there 3 imageviews. trying iterate through table , setimageresource each imageview in table. have tried using code, getting stuck problem. beginner @ android, appreciated, thank you.

my code follows...

tablelayout tablelayout = (tablelayout) findviewbyid(r.id.tablelayout); tablerow tablerow = (tablerow)tablelayout.getchildat(0); imageview imageview = (imageview)tablerow.getchildat(0);   int x = tablelayout.getchildcount(); for(int = 0;  < x; i++){     tablerow= (tablerow)tablelayout.getchildat(i);     for( int j = 0; j < 3; j++){         imageview = (imageview)tablerow.getchildat(j);         imageview.setimageresource(0);     } } 


Comments