Page 876 - 3-3
P. 876

new int[]{R.id.name, R.id.status2, R.id.date} // TextView  추가
                         );
                         list.setAdapter(adapter); //  리스트 어댑터를 불러옴
                     } catch (JSONException e) {
                         e.printStackTrace();
                     }
                 }
                 // JSON  파싱
                 protected void showList2() {
                     try {
                         JSONObject jsonObj = new JSONObject(myJSON2);// JSON       생성
                     peoples = jsonObj.getJSONArray(TAG_JSON2);// TAG_JSON        값과 일치하는 DB        값을 불
             러옴
                         for (int i = 0; i < peoples.length(); i++) {
                             JSONObject c = peoples.getJSONObject(i);
                             String name = c.getString(TAG_Name); // TAG_Name     값을 name   에 저장
                             String status = c.getString(TAG_Status); // TAG_Status 값을 status  에 저장
                             String date = c.getString(TAG_Date); // TAG_Date  값을 date  에 저장
                             HashMap<String, String> persons = new HashMap<String, String>();
                             persons.put(TAG_Name, name); // name    값 추가
                             persons.put(TAG_Status, status); // status 값 추가
                             persons.put(TAG_Date, date); // date 값 추가
                             personList.add(persons); //  리스트에 추가
                         }
                         ListAdapter adapter = new SimpleAdapter(
              Info_teacher.this, personList, R.layout.item_list2, // List 를 작성할 TextView 가 있는 xml   를 불러
             옴
                             new String[]{TAG_Name, TAG_Status, TAG_Date}, //       리스트에 들어갈 내용 추
             가
                                 new int[]{R.id.name, R.id.status2, R.id.date} // TextView  추가
                         );
                         list.setAdapter(adapter); //  리스트 어댑터를 불러옴
                     } catch (JSONException e) {
                         e.printStackTrace();
                     }
                 }
                 // JSON  파싱
                 protected void showList3() {
                     try {
                         JSONObject jsonObj = new JSONObject(myJSON3);// JSON       생성
                     peoples = jsonObj.getJSONArray(TAG_JSON3);// TAG_JSON        값과 일치하는 DB        값을 불
             러옴
                         for (int i = 0; i < peoples.length(); i++) {
                             JSONObject c = peoples.getJSONObject(i);
                             String name = c.getString(TAG_Name); // TAG_Name     값을 name   에 저장


                                                        - 876 -
   871   872   873   874   875   876   877   878   879   880   881