안드로이드 개발 질문/답변
(글 수 45,052)
11-01 08:56:48.425 E/AndroidRuntime(10080): FATAL EXCEPTION: main
11-01 08:56:48.425 E/AndroidRuntime(10080): 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. [in ListView(2131099654, class android.widget.ListView) with Adapter
AsyncTask를 사용하여 Text를 읽어온 뒤 ListView에 뿌려주는 역할을 하도록 처리하였습니다.
하지만 동작중 항상은 아니고 가끔~씩 위와 같은 에러가 발생해서 종료가 됩니다. 문제가 어떤것 인지 혹시 짐작가는 부분이 있으신가요?
doInBackground함수에서 String으로 읽어온 뒤 notifyDataSetChanged()를 onPostExecute에서 처리하도록 하였습니다.
혹시 문제가 될만한 부분이 있을까요?
doInBackground() 메서드에서 Adapter 인스턴스의 데이터를 변경하는게 있나보네요?
adapter.add() 라던가...