/***********************관심지역목록*************************/
private static final String LOG_TAG = "Expandable";
static final String si[] = { "서울시", "경기도", "부산시", "제주도" };
static final String gu[][] = {
// Shades of 서울
{ "서울시 >", "종로구", "서울시 >", "동대문구", "서울시 >",
"용산구" },
// Shades of 경기
{ "경기도 >", "용인시", "경기도 >", "수원시",
"경기도 >", "의정부시" },
// Shades of 부산
{ "부산시 > ", "영도구" },
// Shades of 제주
{ "제주도 > ", "제주시"} };
/**************************Expandable***************************/
SimpleExpandableListAdapter expListAdapter = new SimpleExpandableListAdapter(
this, createGroupList(), // groupData describes the first-level
// entries
R.layout.group_row, // Layout for the first-level entries
new String[] { "siName" }, // Key in the groupData maps to
// display
new int[] { R.id.childname }, // Data under "colorName" key goes
// into this TextView
createChildList(), // childData describes second-level entries
R.layout.child_row, // Layout for second-level entries
new String[] { "siName", "guName" }, // Keys in childData maps
// to display
new int[] { R.id.childname, R.id.guName } // Data under the keys
// above go into these
// TextViews
);
setListAdapter(expListAdapter);
}
public void onContentChanged() {
super.onContentChanged();
Log.d(LOG_TAG, "onContentChanged");
}
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
Log.d(LOG_TAG, "onChildClick: " + childPosition);
CheckBox cb = (CheckBox) v.findViewById(R.id.check1);
if (cb != null)
cb.toggle();
return false;
}
public void onGroupExpand(int groupPosition) {
Log.d(LOG_TAG, "onGroupExpand: " + groupPosition);
}
private List createGroupList() {
ArrayList result = new ArrayList();
for (int i = 0; i < si.length; ++i) {
HashMap m = new HashMap();
m.put("siName", si[i]);
result.add(m);
}
return (List) result;
}
private List createChildList() {
ArrayList result = new ArrayList();
for (int i = 0; i < gu.length; ++i) {
// Second-level lists
ArrayList secList = new ArrayList();
for (int n = 0; n < gu[i].length; n += 2) {
HashMap child = new HashMap();
child.put("siName", gu[i][n]);
child.put("guName", gu[i][n + 1]);
secList.add(child);
}
result.add(secList);
}
return result;
}
-----------------------------------------------------------
Expandablelistview에서
childgroup의 체크박스에서 체크시
체크한 것을 바로바로 TextView로 띄워주려하는데
어떻게 띄울수 있을까요 ㅠㅠ
예를들어 서울시> 종로구가 체크되면
TextView로 서울시> 종로구가 띄워져야 합니다.
도와주세요 ㅠㅠ