2011-04-26 3 views
0

현재 어댑터를 사용하는 ExtendedListView를 구현하려고합니다. 나는 활동이 같은보기를 구현 해요 :다른 클래스에서 정의 된 ExtendedListView가 보이지 않습니다.

groupView = new GroupView((ExpandableListView) findViewById(R.id.groupView), getApplicationContext()); 

GroupView의 생성자는 다음과 같습니다

public GroupView(ExpandableListView list, Context c) 
{ 
    context = c; 
    expandableListView = list; 
    adapter = new GroupViewAdapter(context, 
      new ArrayList<ParticipantGroup>(), 
      new ArrayList<ArrayList<Participant>>()); 
    expandableListView.setAdapter(adapter); 

} 

어댑터는 다음과 같습니다 갈 때

public class GroupViewAdapter extends BaseExpandableListAdapter 
{ 

    private Context       context; 
    private ArrayList<ParticipantGroup>  groups; 
    private ArrayList<ArrayList<Participant>> children; 

    public GroupViewAdapter(Context context, ArrayList<ParticipantGroup> groups, 
      ArrayList<ArrayList<Participant>> children) 
    { 
     this.context = context; 
     this.groups = groups; 
     this.children = children; 
    } 


    /** 
    * Gets the complete structure (Map of groups with a list of participants 
    * each) and draws it 
    */ 
    public void updateView() 
    { 
     Map<String, ParticipantGroup> groupMap = GroupManager.getInstance() 
       .getGroups(); 
     for (Map.Entry<String, ParticipantGroup> entry : groupMap.entrySet()) 
     { 
      String groupName = entry.getKey(); 
      ParticipantGroup group = entry.getValue(); 

      if(!groups.contains(group)) //In case the group does not exist yet, it gets created 
      { 
       groups.add(group); 
      } 
      int index = groups.indexOf(group); 
      if (children.size() < index + 1) { 
       children.add(new ArrayList<Participant>()); 
      } 
      ArrayList<Participant> participants = group.getParticipants(); 
      Iterator<Participant> itr = participants.iterator(); 
      while(itr.hasNext()) 
      { 
       children.get(index).add(itr.next()); 
      } 
     } 
    } 
} 

여물통 나는 그들이에 가정되는 곳에 그룹이 추가되는 것을 본다, 그러나 나는 에뮬레이터에서 실제로 아무것도 볼 수 없다. 그것은 단지 흰색 배경입니다. 실제로 보이지 않게 내가 무엇을 말해 줄 수 있니?

편집 : 좋아, 그것은

답변

0

좋아 없어진 간단한 adapter.notifyDataSetChanged();했다, 그것은

( updateView()를 호출 한 후) 실종됐다 간단한 adapter.notifyDataSetChanged();했다
관련 문제