天天看點

volley擷取緩存資料

使用volley擷取網絡資料,同時會吧資料緩存下來儲存在/data/data/軟體包/cache/volley下 。Volley 本身有緩存機制,不僅僅預設緩存圖檔,也有緩存Json資料。

//mQueues是請求隊列
Entry entry =mQueues.getCache().get(url)
if (entry != null) {
    String result = new String(entry.data);             
}
           

解析擷取到的result即可