Note that there are some explanatory texts on larger screens.

plurals
  1. POwrong images are displaying first and then correct images are displaying during scrolling of listview
    primarykey
    data
    text
    <blockquote> <p>I am using listview with images in my application.But whenever I scroll the list the wrong images are shown first and then the correct images are displaying.I dont know why it is happening like this.I think already loaded images are displaying until the position is set. Here is my adapter class,please help me where I am going wrong</p> </blockquote> <pre><code> public class MySimpleArrayAdapter extends ArrayAdapter&lt;String&gt; { private Activity context; ArrayList&lt;String&gt; namear,msgar,idar,profimage,postimage,commentsnum,objectid,urlString; ImageLoader imageLoader; Bitmap[] bitdata; public MySimpleArrayAdapter(Activity c,int i,ArrayList&lt;String&gt; postpic, ArrayList&lt;String&gt; names,ArrayList&lt;String&gt; msg,ArrayList&lt;String&gt; id,ArrayList&lt;String&gt; proimg,Bitmap[] bit,ArrayList&lt;String&gt; comment,ArrayList&lt;String&gt; objid,ArrayList&lt;String&gt; web) { super(c, i, names); Log.e("adapter","adap"); this.context = c; this.namear = names; this.msgar = msg; this.idar = id; this.profimage=proimg; this.postimage=postpic; this.bitdata=bit; this.commentsnum=comment; this.objectid=objid; this.urlString=web; this.imageLoader = new ImageLoader(context); } @Override public View getView(final int position, View convertView, ViewGroup parent) { View rowView=convertView; ViewHolder holder = new ViewHolder(); if(convertView == null) { LayoutInflater inflator = getLayoutInflater(); rowView = inflator.inflate(R.layout.walldata, null); holder.name1 = (TextView) rowView.findViewById(R.id.name); holder.message1 = (TextView) rowView.findViewById(R.id.msg); holder.profimg= (ImageView) rowView.findViewById(R.id.profile_pic); holder.postimg= (ImageView) rowView.findViewById(R.id.picpost); holder.comments = (TextView) rowView.findViewById(R.id.comment); rowView.setTag(holder); Log.e("user",idar.get(position)); } else { holder = (ViewHolder) rowView.getTag(); } Log.e("adapter","adap"); holder.name1.setText(namear.get(position)); if(msgar.get(position)!=""){ holder.message1.setText(msgar.get(position)); } else { holder.message1.setVisibility(View.GONE); } if(!postimage.get(position).equals("")) {try{ imageLoader.DisplayImage(postimage.get(position).replace(" ", "%20"), holder.postimg) ; } catch(Exception e){ e.printStackTrace(); } } else { holder.postimg.setVisibility(View.GONE); } try{ imageLoader.DisplayImage(profimage.get(position).replace(" ", "%20"), holder.profimg) ; } catch(Exception e){ e.printStackTrace(); } holder.comments.setText(commentsnum.get(position)+"\t"+"Comments"); holder.comments.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Intent myintent=new Intent(Wall.this,Comments.class); myintent.putExtra("name", namear.get(position)); myintent.putExtra("profimg", profimage.get(position)); myintent.putExtra("message", msgar.get(position)); myintent.putExtra("postpic", postimage.get(position)); myintent.putExtra("objectid", objectid.get(position)); myintent.putExtra("commentsnum",commentsnum.get(position)); myintent.putExtra("webservice", urlString.get(position)); startActivity(myintent); } }); return rowView; } } public class ViewHolder{ TextView name1, message1,comments; ImageView profimg,postimg; } </code></pre>
    singulars
    1. This table or related slice is empty.
    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