private ExpandableListView listview;
private ArrayList<String> GroupList = null;
private ArrayList<ArrayList<String>> ChildList = null;
private ArrayList<String> ChildListContent = null;
private Notice_Adapter notice_Adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.notice_main);
setLayout();
GroupList = new ArrayList<String>();
ChildList = new ArrayList<ArrayList<String>>();
ChildListContent = new ArrayList<String>();
GroupList.add("제목1");
GroupList.add("제목2");
GroupList.add("제목3");
GroupList.add("제목4");
ChildListContent.add("가나다라마바사아자차카타파하\n 1234567890 ");
ChildList.add(ChildListContent);
ChildList.add(ChildListContent);
ChildList.add(ChildListContent);
ChildList.add(ChildListContent);
notice_Adapter = new Notice_Adapter(this, GroupList, ChildList);
listview.setAdapter(notice_Adapter);
// 그룹 클릭 했을 경우 이벤트
listview.setOnGroupClickListener(new OnGroupClickListener() {
public boolean onGroupClick(ExpandableListView parent, View v,
int groupPosition, long id) {
return false;
}
});
// 차일드 클릭 했을 경우 이벤트
listview.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
return false;
}
});
// 그룹이 닫힐 경우 이벤트
listview.setOnGroupCollapseListener(new OnGroupCollapseListener() {
@Override
public void onGroupCollapse(int groupPosition) {
}
});
// 그룹이 열릴 경우 이벤트
listview.setOnGroupExpandListener(new OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
}
private void setLayout() {
listview = (ExpandableListView) findViewById(R.id.notice_list);
}
});
다음과 같이 소스를 작성하였습니다.
그런데 지금 결과를 보면 제목1, 제목2, 제목3, 제목4을 클릭하면 모두
가나다라마바사아자차카타파하, 1234567890 같은 내용이 보여지는데요
이것을 각각 제목마다 다른 내용이 나오게 하려면 어떻게 해야되나요?