import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ExpandableListAdapter;
import android.widget.ExpandableListView;
import android.widget.SimpleExpandableListAdapter;
public class Hospital extends Activity {
ExpandableListView mList;
String[] arProv = new String[] {
"충청도", "경기도", "강원도"
};
String[][] arCity = new String[][] {
{"논산", "당진", "부여"},
{"수원", "용인"},
{"춘천", "원주", "홍천", "강릉"},
};
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hospital);
mList = (ExpandableListView)findViewById(R.id.list);
//mList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
List<Map<String, String>> provData = new ArrayList<Map<String, String>>();
List<List<Map<String, String>>> cityData =
new ArrayList<List<Map<String, String>>>();
for (int i = 0; i < arProv.length; i++) {
Map<String, String> Prov = new HashMap<String, String>();
Prov.put("prov", arProv[i]);
provData.add(Prov);
List<Map<String, String>> children = new ArrayList<Map<String, String>>();
for (int j = 0; j < arCity[i].length; j++) {
Map<String, String> City = new HashMap<String, String>();
City.put("city", arCity[i][j]);
children.add(City);
}
cityData.add(children);
}
ExpandableListAdapter adapter = new SimpleExpandableListAdapter(
this,
provData,
android.R.layout.simple_expandable_list_item_1,
new String[] { "prov" },
new int[] { android.R.id.text1 },
cityData,
android.R.layout.simple_list_item_multiple_choice,
new String[] { "city" },
new int[] { android.R.id.text1 }
);
mList.setAdapter(adapter);
}
}
어디다가 초이스모드를 넣으면 체크박스가 중복 체크 되는건지 도저히 모르겠어요 ㅠㅠㅠ
이걸로 3일 헤메고 이써요 도와주세요 ㅠㅠㅠㅠ
엠리스트 에드 어펜더 밑에도 써보앗지만 작동이 되질않아요 ㅠㅠ
도와주세요 고수님들 ㅠㅠ
한줄만 추가하면 될듯한데 어디다가 해야할지 ㅠㅠ xml 은 어짜피 한것도 없으니깐 자바파일만 잇으면 될거같아서 자바파일만 올렸습니다 ㅠㅠ