HttpResponseCache not working in Android Lollipop

前端 未结 2 1458
天命终不由人
天命终不由人 2021-01-03 06:46

I\'ve been using in my app HttpResponseCache successfully, but when my phone updated to Lollipop I realized that HttpResponseCache now never get \"hit\", always do the netwo

2条回答
  •  时光取名叫无心
    2021-01-03 07:13

    I've had similar problem. I was expecting images to be cached but they weren't.

    What turned out to be the problem was that I was not closing InputStream after it being read into a Bitmap.

    Your fetchInputStream returns an InputStream that it got from http connection, make sure you close it properly.

    The android http cache will not save a resource until you close the connection's InputStream.

提交回复
热议问题