This is because you only install the image when the convertView is null (this will happen, for example, when the GridView first displayed on the screen), and as the GridView scrolls (the convertView will not be empty), it will recycle the row views, so you get the old rows that you have not updated with new images / text. Your code should look like this:
View v; if (convertView == null) { // if it not recycled, initialize some attributes LayoutInflater li = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = li.inflate(R.layout.icon, null); } else { v = (View) convertView; } TextView tv = (TextView)v.findViewById(R.id.icon_text); tv.setText(kraj[position]); ImageView iv = (ImageView)v.findViewById(R.id.icon_image); iv.setImageResource(mThumbIds[position]); iv.setScaleType(ImageView.ScaleType.CENTER_CROP); iv.setLayoutParams(new LinearLayout.LayoutParams(mniejszy, mniejszy)); return v;
source share