I use Glide with recyclerview .When I run my app on my device for first
time (Using android studio) images loaded correctly but after press back and
finish app then open app again images not load and I must click on cards(Click
on card opens new activity) to load display images (it seems
images cached but not load)
I enable all type of debug logging but don't get any
exception or error
Glide.with(mContext)
.load(Uri.parse(image.getImage_url()))
.listener(new RequestListener<Uri, GlideDrawable>() {
@Override
public boolean onException(Exception e, Uri model, Target<GlideDrawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(GlideDrawable resource, Uri model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource){
if (dialog.isShowing())
dialog.dismiss();
return false;
}
})
.into(holder.image);
This code in recyclerview adapter
Glide Version 3.7.0
And this is layout of elements of adapter
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/card_view"
card_view:cardCornerRadius="4dp"
android:clickable="true"
android:focusable="true"
android:layout_weight="1"
android:layout_margin="2dp"
android:background="?android:attr/selectableItemBackground"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/activity_project_pro_image"
android:layout_width="match_parent"
android:background="@drawable/card_view_image_holder"
android:scaleType="fitXY"
android:layout_height="200dp" />
<customfonts.MyTextViewLight
android:id="@+id/activity_project_pro_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/design_name"
android:textSize="18dp"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:gravity="center_horizontal"
android:textColor="#aa000000"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/under_line"
/>
<LinearLayout
android:layout_marginTop="4dp"
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageButton
android:layout_gravity="left"
android:id="@+id/image_activity_share_btn"
android:layout_width="32dp"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/card_share"
android:scaleType="fitXY"
android:layout_marginRight="100dp"
android:contextClickable="true"
android:layout_height="32dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageButton
android:layout_gravity="left"
android:id="@+id/image_activity_save_btn"
android:layout_width="32dp"
android:background="?android:attr/selectableItemBackground"
android:src="@drawable/card_downlaod"
android:scaleType="fitXY"
android:layout_marginRight="5dp"
android:contextClickable="true"
android:layout_height="32dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
Sorry for long post