Reputation: 624
Here the image is not completely loaded. I don't know why. Somehow half placeholder & somehow half image. Sometimes it loads without any issue.
I am using
implementation 'com.github.bumptech.glide:glide:3.7.0'
Here is my code
val headerView = nav_view.getHeaderView(0)
Glide.with(act).load(userdata.image).placeholder(R.drawable.ic_male).thumbnail(0.2f).into(headerView.imgNavDp)
XML
<de.hdodenhof.circleimageview.CircleImageView
android:layout_marginLeft="@dimen/dim_5"
android:id="@+id/imgNavDp"
android:layout_width="@dimen/dim_76"
android:layout_height="@dimen/dim_76"
android:elevation="@dimen/dim_10"
android:layout_gravity="center_vertical"
app:srcCompat="@mipmap/ic_launcher_round" />
Upvotes: 1
Views: 1157
Reputation: 11457
There is a work around to handle loading error issues in Glide
import this, and keep the compile sdk version to 27
compile 'com.github.bumptech.glide:glide:3.8.0'
then Use this code
Glide.with(context)
.load(userdata.image)
.placeholder(R.drawable.ic_male)
.error(R.drawable.imagenotfound)
.listener(new RequestListener<String, GlideDrawable>() {
@Override
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
// log exception
Log.e("TAG", handle error case", e);
return false;
}
@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
Log.e("TAG", handle success case here", e);
return false;
}
})
.into(headerView.imgNavDp);
and remove this from xml
app:srcCompat="@mipmap/ic_launcher_round"
Upvotes: 3