Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gilde repeating images in GridView when using custom adapter #193

Closed
penmatsa opened this issue Oct 16, 2014 · 8 comments
Closed

Gilde repeating images in GridView when using custom adapter #193

penmatsa opened this issue Oct 16, 2014 · 8 comments
Labels

Comments

@penmatsa
Copy link

I am using glide library jar to load images in grid view. In had used a custom adapter with viewholder but still some images in gridview get repeated.

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder = new ViewHolder();
    if(convertView==null){
        convertView=inflater.inflate(R.layout.displayadapter_layout, parent, false);
        viewHolder.imageview=(ImageView)convertView.findViewById(R.id.background);
        viewHolder.title=(TextView) convertView.findViewById(R.id.title);

        convertView.setTag(viewHolder);
    }else{
        viewHolder=(ViewHolder) convertView.getTag();
    }

    Glide.with(context).load(list.get(position).Image_Url()).into(viewHolder.imageiew);
    viewHolder.title.setText(newslist.get(position).getTitle());

    return convertView;
}

public static class ViewHolder {
    private ImageView imageview;
    private TextView title;
}
@sjudd
Copy link
Collaborator

sjudd commented Oct 17, 2014

Can you reproduce it if you build from master (instructions on how to do so are on the wiki)?

The Flickr sample uses a grid and I haven't yet noticed this problem. Does anything you do make it more or less frequent? Are any of your urls ever null?

As far as I can tell your code here looks correct.

@AlexBlokh
Copy link

This is because you do not set the placeholder. And when you scroll you got the reused image view with bitmap, that have been loaded before. And when a new image is downloaded glide replaces it

@penmatsa
Copy link
Author

using volley my code works fine but when i use Glide library images get repeated

@sjudd
Copy link
Collaborator

sjudd commented Oct 17, 2014

@AlexBlokh In theory setting a placeholder shouldn't be necessary, Glide is supposed to set a null drawable by default if no placeholder is set.

@penmatsa Can you create a small sample project that reproduces the problem that I can take a look at? I'd love to figure out what's going wrong here.

@penmatsa
Copy link
Author

ya sure i will send you sample app

@sjudd
Copy link
Collaborator

sjudd commented Nov 4, 2014

Please re-open if you get the chance to add a sample app, I'm definitely interested in fixing this if there's something to fix.

@sjudd sjudd closed this as completed Nov 4, 2014
@revolver4u
Copy link

facing the same issue with Glide..

@TWiStErRob
Copy link
Collaborator

Hey, thanks for bringing it up. So far we weren't able to reproduce it. We'll definitely take a look, if you can give a sample app which can be run and shows the issue (github or zip doesn't matter). Without that there is not much we can do, because it works in every case we've encountered.

Before this you should make sure you're using the latest Glide 3.6.0 and try clearing your cache and may also worth checking your images manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants