In my app I want to download images from url and show them in recyclerView. And basically everything is ok - when I download images, turn off wifi and mobile data - cached images are being displayed. Tried several times - it works perfectly. However ... after for example 3-4 hrs I tried again to launch app in offline mode and images were not displayed. Any idea what I'm doing wrong ? Here's my code in basic activity (onCreate) :
Picasso.Builder builder = new Picasso.Builder(getContext());
        builder.downloader(new OkHttp3Downloader(getContext(),Integer.MAX_VALUE));
        Picasso built = builder.build();
        built.setIndicatorsEnabled(true);
        built.setLoggingEnabled(true);
Then I download and cache images like this :
public void onResponse(Call<CallbackListPost> call, Response<CallbackListPost> response) {
                CallbackListPost resp = response.body();
                if (resp != null && resp.status.equals("ok")) {
                    post_total = resp.count_total;
                    displayApiResult(resp.posts);
                    controller = new RealmController(getActivity().getApplication());
                    controller.savePost(resp.posts);
                    for(Post post : resp.posts) {
                        for (final Attachment att : post.attachments) {
                            Picasso.with(getActivity())
                                    .load(att.url)
                                    .fetch(new com.squareup.picasso.Callback() {
                                        @Override
                                        public void onSuccess() {
                                            Log.e(TAG, "onSuccess: " + att.url );
                                        }
                                        @Override
                                        public void onError() {
                                        }
                                    });
                        }
                    }
Then in second activity I display images like this :
public View getView(int position, View convertView, ViewGroup parent) {
            ImageView iv;
            if(convertView == null) {
                iv = new ImageView(mContext);
            } else {
                iv = (ImageView) convertView;
            }
            Picasso.with(mContext)
                    .load(att.get(position).url)
                    .noFade()
                    .resize(150,150)
                    .centerCrop()
                    .into(iv);
                return iv;
        }
 
     
     
    