動態改變的ListView數據我有一個Activity_A那裏是一個的ListView其數據取決於值說依賴安卓:從其他活動
從這個Activity_B用戶進入Activity_B他可以在其中更改依賴項的值
因爲此依賴項必須更改ListView中的數據我必須d重新加載ListView,因此我做到了這一點:
if(//dependency is changed){
Intent intent = new Intent(Activity_B.this,Activity_A.class);
startActivity(intent);
}
ListView中填充了新數據。
問題:
當我從這個新加載Activity_A按下設備後退按鈕兩次,我最終在Activit_A與以前的ListView數據。所以,如果我嘗試點擊任何項目我得到這個異常
The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread
如何避免這種情況?
謝謝