Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 0.49 KB  |  views: 52  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to find element inside a gridview in Android?
  2. gridviewobject.findViewById(thetag);
  3. // gridview object is the object of the gridview that i have populated.
  4.        
  5. final int numVisibleChildren = gridView.getChildCount();
  6. final int firstVisiblePosition = gridView.getFirstVisiblePosition();
  7.  
  8. for ( int i = 0; i < numVisibleChildren; i++ ) {
  9.     int positionOfView = firstVisiblePosition + i;
  10.  
  11.     if (positionOfView == positionIamLookingFor) {
  12.         View view = gridView.getChildAt(i);
  13.     }
  14. }