• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

problem in gridview while scrolling

 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all...

Iam stuck with a strange problem since long...
i have a gridview with images and checkbox and the problem is after selecting the image with checkbox when i scroll down..the above selected checkboxes become uncheckd...
i have no idea why this is happening....my code for the adapter class is like


looking for the hint...which could solve my issue....
i would be really greatful

thankyou
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
these scrolling view reuse Views rather than continuing to create a new one for every item in the list (or grid)
Therefore if your device is able to fit 15 items on the screen, you will only be asked to create 15 views. If you scroll up so that the top row disappears, those Views will be reused on the bottom row rather than requiring new Views to be created.

Coming back to your code, it should now be obvious that you set the checked state when the View is created, but not when it is reused.
Rather than relying on the View to maintain the checked state you should have a custom object associated with the current view and update the custom object when the check state changes.
 
I'm gonna teach you a lesson! Start by looking at this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic