When I start to scroll my view. Its repeating the Image but when I click it open correct image. I tried many solutions but still I can't able to fix it. I tried many thing in converView. But it keep on repeating the image and place it in view.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView;
View v;
if (convertView == null) {
/* LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
v = inflater.inflate(R.layout.gridview_item_layout, parent, false);
*/
imageView = new ImageView(context);
if(images.get(position).contains(".jpg"))
{
bm = BitmapFactory.decodeFile(images.get(position)); //Creation of Thumbnail of image
}
else if(images.get(position).contains(".mp4"))
{
bm = ThumbnailUtils.createVideoThumbnail(images.get(position), 0); //Creation of Thumbnail of video
}
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setPadding(8,8,8,8);
imageView.setLayoutParams(new GridView.LayoutParams(300, 300));
} else {
imageView = (ImageView) convertView;
}
imageView.setImageBitmap(bm);
return imageView;
}
}