마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

expandablelistview 질문

0 추천
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 전환을 하고싶은데
어떻게 해야될지 잘 모르겠습니다.
리뷰즈 (480 포인트) 님이 2015년 4월 5일 질문

1개의 답변

+1 추천
mList.setOnChildClickListener();
익명사용자 님이 2015년 4월 21일 답변
...