views:

486

answers:

0

Ok i wasted 1 day of my life i think now is the time to ask for help :D I have a listview that has an image text ..etc (custom view) and one of its elements is a Gallery. (Aka horizontal listview) Gallery also is a custom view. SO.. here is the problem: I call the adaptor to set the custom view in the listview.Ok for now. Inside the listview adaptor i call the Gallery adaptor.Ok for now. Everything render out as it should be with a very nice complex interface. Now the problem When i scroll the Gallery the data change to what the data should have been if i scrolled the gallery of the last listview row rendered.(Hope you get me here) Ex.gallery in first listview has photos of the sea. gallery in 2nd listview has photos of a building.

If i scroll the first gallery the photos change from "sea" to building".

Meaning ... each time the listview adapter's getView is called i feed the galleryadapter with data

gal1.setAdapter(new GalleryAdapter(CON,PASS[position]));

What i'm thinking as a possible solution is :

  • Hardcore , preload all the data in the custom Gallery of each listview.
  • Figure a way that when i scroll the Gallery element within a listview , the gallery adapter to be aware of the index of listbox and load the correct data.

I think the second solution is more elegant,and more difficult but considering that if i go for the 1st solution there will be >40 views loaded at all times so no biggy.

So.. I;m asking for your help.Is there a 3rd , 4rth .. way?Is anyone of my suggestions even possible?If so please point a way of implement to code.

Keed in mind that i want to be able to do multiple scrollings at any given moment. So i think that my 2nd suggestiong might have some problems there. Thank you and sorry for my english