Skip to content

Instantly share code, notes, and snippets.

@raghunandankavi2010
Created March 12, 2017 04:23
Show Gist options
  • Save raghunandankavi2010/4e7dbd6dfeed3b05c040e5a24eaa2d3b to your computer and use it in GitHub Desktop.
Save raghunandankavi2010/4e7dbd6dfeed3b05c040e5a24eaa2d3b to your computer and use it in GitHub Desktop.
Loading image via glide
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
final ViewHolder viewHolder;
if (convertView == null) {
viewHolder = new ViewHolder();
convertView = mLayoutInflater.inflate(R.layout.all_noti_item, parent, false);
viewHolder.profilePic = (ImageView) convertView.findViewById(R.id.profilePic);
convertView.setTag(viewHolder);
}else
{
viewHolder = (ViewHolder) convertView.getTag();
}
if(feedItems.get(position).getUser_details()!=null) {
Glide.with(activity).load(feedItems.get(position).getUser_details().getUser_profile_image())
.bitmapTransform(new CropCircleTransformation(activity))
.placeholder(R.drawable.pod_h)
.into(viewHolder.profilePic);
}else
{
// make sure Glide doesn't load anything into this view until told otherwise
Glide.clear(viewHolder.profilePic);
// remove the placeholder (optional); read comments below
//viewHolder.profilePic.setImageDrawable(null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment