今天除錯介面,獲取了資料,解析成list,然後呼叫
notifyDataSetChanged 這個方法重新整理介面卡 結果沒反應
通過debug 和分析程式碼 發現
notifyDataSetChanged這個方法根據記憶體地址判斷資料有沒有更新
而我寫的是list = gson.fromJson(str,typeToken()...)
這個時候list就是一個新的指定記憶體物件了,
這樣呼叫重新整理的辦法 無法判斷出資料是否已經重新整理了
也就等同於沒有呼叫
解決辦法就是list.addAll 這樣 list地址沒有改變
