Advertisement
Guest User

Untitled

a guest
Jun 17th, 2012
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement