大家好,
我使用AsyncTask非同步的去伺服器取得一個ArrayList
讓adapter吃進ArrayList並動態更新ListView裡Item的資料.
點擊Item時會取得Item Position並再去後台取得詳細資訊,
之後用一個Activity呈現這個資訊.
但現在在點擊Item時三不五時就會出現下列Exception:
java.lang.IllegalStateException: 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.
Google之後我有修正更新通知:
private class getDispatchedTask extends AsyncTask<String, Integer, String>{
...
protected void onPostExecute(String result) {
...
adapter.notifyDataSetChanged();
}
}
但問題還是會發生
請教高手協助
謝謝~