xml 구문 분석에서 확장 가능한 listview에서 데이터를 새로 고친 후 notifydatasetchanged를 호출했지만 응용 프로그램이 손상되고 있습니다. 내 어댑터 클래스가 BaseExpandableListAdapter를 확장하고 있습니다. 나는 다음과 같은 코드를 사용했다 : 방법 "projected_values"에서.notifydatasetchanged가 android의 확장 가능한 목록보기에서 작동하지 않습니다.
class PushNotification extends AsyncTask<String, Void, Void> {
@Override
protected Void doInBackground(String... arg0) {
makeGetRequest();
return null;
}
@Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
listAdapter = new ExpandableListAdapter(ct, values, scores);
for(int i=0;i<values.size();i++){
}
expListView.setAdapter(listAdapter);
listAdapter.notifyDataSetChanged();
expListView.setOnGroupClickListener(new OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v,
int groupPosition, long id) {
values.clear();
projected_values(groupPosition);
listAdapter.notifyDataSetChanged();
return false;
}
});
그룹 클릭 리스너를 들어, 내가 포기하고 값을. 오류 다음 로그 캣 쇼
09-23 02:45:43.469: E/AndroidRuntime(3563): FATAL EXCEPTION: main
09-23 02:45:43.469: E/AndroidRuntime(3563): Process: com.example.xmlparsing, PID: 3563
09-23 02:45:43.469: E/AndroidRuntime(3563): 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. Make sure your adapter calls notifyDataSetChanged() when its content changes. [in ListView(2131296256, class android.widget.ExpandableListView) with Adapter(class android.widget.ExpandableListConnector)]
09-23 02:45:43.469: E/AndroidRuntime(3563): at android.widget.ListView.layoutChildren(ListView.java:1555)
09-23 02:45:43.469: E/AndroidRuntime(3563): at android.widget.AbsListView.onTouchUp(AbsListView.java:3617)
09-23 02:45:43.469: E/AndroidRuntime(3563): at android.widget.AbsListView.onTouchEvent(AbsListView.java:3429)
09-23 02:45:43.469: E/AndroidRuntime(3563): at android.view.View.dispatchTouchEvent(View.java:7690)
09-23 02:45:43.469: E/AndroidRuntime(3563): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2210)
09-23 02:45:43.469: E/AndroidRuntime(3563): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1945)
는
나는 내 코드를 수정했다. .. Runonuithread에서 notifydatasetchanged를 작성하고 oncreate ..에서 onclicklisteners를 작성했지만 동일한 오류가 발생했다. – Chowdary102