listView에 문제가 있습니다. ArrayList를 사용하여 데이터를 저장하고 사용자 정의 된 어댑터를 사용했습니다. 그러나 모든 데이터를 제거하고 항목 하나를 다시 추가하면이 목록에 아무 것도 표시되지 않습니다. 아무도 내 목록에 어떻게됩니까? 내가 ListView에 활동을 시작하고 데이터를 추가 할 때안드로이드 : 빈 listView에 데이터를 추가하는 방법
static ArrayList<String> chattingListData=new ArrayList<String>();
static IconicAdapter chattingListDataAdapter;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
chattingListDataAdapter=new IconicAdapter(this);
setListAdapter(chattingListDataAdapter);
registerForContextMenu(this.getListView());
}
class IconicAdapter extends ArrayAdapter {
Activity context;
IconicAdapter(Activity context) {
super(context, R.layout.chatting_list, chattingListData);
this.context=context;
}
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater=context.getLayoutInflater();
View row=inflater.inflate(R.layout.chatting_list, null);
TextView label=(TextView)row.findViewById(R.id.chattinglist_userName);
label.setText(chattingListData.get(position));
return(row);
}
}
나는 괜찮아, 외부에서 데이터를 수정하는 정적의 ArrayList를 사용하지만, 나는 모든 데이터를 제거 할 때, 나는 데이터 목록에 더 이상 추가 할 수 없습니다. 도와주세요. 그렇게하지 마십시오
목록을 변경하는 코드를 Google에 알려주세요. – Janusz