Android Listview getting repeated elements on scroll -
I am using listview in the Android application I have to download various images from the web and add them under each list element to save in the SD card for future reference, downloading the image, working as expected.
But as I tried to scroll the list, some images of some elements were first copied or moved to the final elements.
This is a very strange behavior that has not yet come to me.
Please help me if anyone gets the same problem.
Thank you in advance.
Be sure to implement recycling on your LIVE adapter. Here the list is a sample of the adapter that is recycling:
Public Squared Newsrender ArrayAdapter and lt; NewsDto & gt; {Personal Final Reference Reference; ArrayList & LT; NewsDto & gt; NList; Public News Adapter (Reference Reference, Arreelist and News Dot> NLIT) {Super (References, R. Late Fragment_News_item, NLIS); This.context = context; This nList = nList; // Tudo Auto-Generated Producer Stub} Public Square Viewer {Text View Details; ImageView image1} @ Override public view getView (last integer status, seeviewview, ViewGroup parent) {View view = convertView; Final View Holder Holder; LayoutsInflator Inflator = (Layout Influenor) Reference .getSystemService (References LAOUT_INFLATER_SERVICE); If (see == faucet) {view = inflater.inflate (R. Late Fragment_News_item, parent, wrong); Holder = new viewholder (); View holder = details = (text view) Fundawiibid (rd.news_details); Holder.image1 = (ImageView) view.findViewById (R.id.news_image1); View.setTag (holder); } Else {holder = (viewholder) view.getTag (); } // Get a single data from your list News Dots News dot = nelli.get (status); // Image holder initialization. Image1.setImageBitmap (newsDto.getImage ()); Return view; }} On using this, it uses a class to save the tag of each item in the list view. So that your initials will be recycled when you scroll back to a particular item that is already initialized.
Comments
Post a Comment