java - Images in list view jumping from row to row -
I am using a ListView with images, I have an image loader The problem is that when a scrolling fast , The images appear on the wrong lines, when scrolling is off, then everything is returned.
This is my adapter:
the public class increases MyAdapter ArrayAdapter & lt; MyObj & gt; {Int layoutsource id; & Lt; MyObj & gt; Information; Activity activity; Int rowViewId; Public MyAdapter (Activity Activity, Int Layoutsource ID, List & lt; MyObj & gt; Data) {Super (Activity, Layoutsource ID, Data); This.layoutResourceId = layoutResourceId; This.activity = Activity; This.data = data; RowViewId = R. Layout. My_layout.xml; } Public Static Class Viewer {Public Text View Title; Public image view image; } @ Override Public View getView (View of Entity, Viewview, ViewGroup Parent) {View Line = Convertview; See holder holder; If (line == empty) {Layout Influent Layout Infographic = (Layout Influter) Activity .getSystemService (Reference. LEOUT_INFLATER_SERVICE); Line = layoutInflator.InFlight (lineviewId, empty); Holder = new viewholder (); Holder.title = (TextView) line.find.title; Holder = .image = (ImageView) line.Findvibid (RID.IJG); Row.setTag (holder); } Other {holder = (viewholder) row .getTag (); } Last MyObj obj = data.get (status); If (event! = Null) {holder.title.setText (event.getTitle ()); Imageloader imageloader = new imageloader (); ImageLoader.loadImageFromAppServer (obj.getImageName (), holder image); } Return line; }}
Can I do anything to prevent this unwanted behavior?
Your image is being loaded unlimitedly by loadImageFromAppServer
. When it comes from the server, your holder. Image
is already being used again from the second line, which does not display the data that you asked to download your ImageLoader
object. You have to implement a way to tell the ImageLoader
object to cancel the previous download request.
Comments
Post a Comment