Note that there are some explanatory texts on larger screens.

plurals
  1. POImageView overlap when adding more items in existing ListVIew
    primarykey
    data
    text
    <p>I am creating a <code>ListView</code> which as a <code>TextView</code> and <code>ImageView</code> as a list item row.</p> <p>initially i am loading default items from local database in a listview view and I have a <code>update button</code> on the top of listview to load more items from server</p> <p>when a user press an <code>update button</code> i am firing a <code>AsyncTask</code> which pull the <strong><em>icon urls and text</em></strong> from the server.</p> <p>to load an icon in a ImageView i am using sample of <a href="https://i.stack.imgur.com/SHJfu.png" rel="nofollow noreferrer">ImageDownloader</a> but the issues is my ImageView is getting overlapped with the old ImageViews bcoz of ViewHolder pattern. so can someone poit me what am i doing wrong ?</p> <p>and here is my ListView Adapter code</p> <pre><code>@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; TemplateData data = (TemplateData) this.getItem( position ); if(convertView == null){ LayoutInflater inflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView=inflater.inflate(R.layout.text_template_default_row, parent, false); holder = new ViewHolder(); holder.templateText = (TextView) convertView.findViewById(R.id.defText); holder.templateIcon = (ImageView)convertView.findViewById(R.id.defIcon); holder.templateTitle = (TextView) convertView.findViewById(R.id.defTitle); convertView.setTag(holder); }else{ holder = (ViewHolder)convertView.getTag(); } holder.templateText.setText(data.getText() ); holder.templateTitle.setText(data.getTemplateTitle()); //isImageLoading initially sets to false so that default items will use the // resource ids , it gets falsed when AsyncTask finished load Images and update the //adapter and at that time this adapter has to pic the image from ImageDowloader if(!isImageLoading) data.setTemplateIconId(iconList[position]); //Has resource id but not icon url if(data.getTemplateIconId()!=0 &amp;&amp; data.getTemplateIconUrl()==null ){ Log.d("Load icon ","Default Load"); holder.templateIcon.setBackgroundResource(data.getTemplateIconId()); // does not has recource id so load url from server }else if(data.getTemplateIconUrl()!=null &amp;&amp; data.getTemplateIconId()==0){ Log.d("Load icon ","From Server Load"); imageDownloader.download(data.getTemplateIconUrl(), (ImageView) holder.templateIcon); } return convertView; } </code></pre> <p>iconList contains the resources ids of existing icons in an application. Please feel free to ask if someone wants more information. </p> <p><strong>EDIT</strong> </p> <p>Here are the screen shots</p> <p>Initially there will be 8 templates &amp; its icon which are loading from database stored in a android phone only. its name start from template 1 to template 6</p> <p><img src="https://i.stack.imgur.com/SHJfu.png" alt="default view"></p> <p>now when a user presses <strong>update</strong> button new templates will be loaded over here. its name starts from template new 1 to template new 9 but the imageViews gets overlapped when i scroll up n down</p> <p>here is the screen shots</p> <p><img src="https://i.stack.imgur.com/AdmPa.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload