How to make Volley NetworkImageView worke offline

前端 未结 6 2131
悲&欢浪女
悲&欢浪女 2021-02-10 18:04

I use Volley NetworkImageView to download images from internet and show in my listview. Now I want to make Volley NetworkImageView show sa

6条回答
  •  野性不改
    2021-02-10 18:50

    1. Search internet for "android how to check internet connectivity"
    2. implement that and check it in your cache implementation (like LruCache). if(networkAvailable()){ getFromNetwork()} else { getFromCache()}

    logic is ok? then just try.
    It seems your cache impl class is LruBitmapCache.

    then how about check connectivity in that class?

    public Bitmap getBitmap(String url) {
      if(networkAvailable()/* this is your impl */){
        // dont use cache
        return null;
      }
      return getFromCache();  // or something like that;
    }
    

提交回复
热议问题