public class CooklistActivity extends Activity {
ExpandableListView mList;
String[] arProv = new String[] { "동서울종합터미널" , "서울고속버스터미널" , "아이고" , "이걸" , "우짜냐" };
String[][] arCity = new String[][] { //서울 고속버스터미녈은 강남
{ "부산종합버스터미널" },{"부산서부버스터미널" , "부산종합버스터미널" },
{ "1" , "2" , "3" , "4" }, { "5" , "6" , "7" , "8" }, { "9" , "0" },
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout. activity_cooklist);
mList = (ExpandableListView)findViewById(R.id. list);
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_expandable_list_item_1 ,
new String[] { "city" },
new int[] { android.R.id. text1 }
);
mList.setAdapter(adapter);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu. cooklist, menu);
return true;
}
}
지금 까지 소스 입니다. 부산종합버스터미널와 같은 child를 클릭 했을때 intent를 이용한 activity 전환을 하고싶은데
어떻게 해야될지 잘 모르겠습니다.