Page 868 - 3-3
P. 868

Schedule.this, personList, R.layout.item_list, // List 를 작성할 TextView   가
             있는 xml   를 불러옴
                                 //  리스트에 들어갈 내용 추가
                                 new     String[]{TAG_PERIOD,      TAG_MON,       TAG_TUE,      TAG_WED,
             TAG_THU, TAG_FRI},
                                 new int[]{R.id.period, R.id.mon, R.id.tue, R.id.wed, R.id.thu, R.id.fri} //
             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 period = c.getString(TAG_PERIOD);// TAG_PERIOD    값을 period   에 저장
                             String mon = c.getString(TAG_MON); // TAG_MON      값을 mon   에 저장
                             String tue = c.getString(TAG_TUE); // TAG_TUE    값을 tue  에 저장
                             String wed = c.getString(TAG_WED); // TAG_WED     값을 wed   에 저장
                             String thu = c.getString(TAG_THU); // TAG_THU    값을 thu  에 저장
                             String fri = c.getString(TAG_FRI); // TAG_FRI 값을 fri 에 저장
                             HashMap<String, String> persons = new HashMap<String, String>();
                             persons.put(TAG_PERIOD, period);    // period 값 추가
                             persons.put(TAG_MON, mon); // mon    값 추가
                             persons.put(TAG_TUE, tue); // tue 값 추가
                             persons.put(TAG_WED, wed); // wed    값 추가
                             persons.put(TAG_THU, thu); // thu  값 추가
                             persons.put(TAG_FRI, fri); // fri 값 추가
                             personList.add(persons); //  리스트에 추가
                         }
                         ListAdapter adapter = new SimpleAdapter(
                                 Schedule.this, personList, R.layout.item_list, // List 를 작성할 TextView   가
             있는 xml   를 불러옴
                                 //  리스트에 들어갈 내용 추가
                                 new     String[]{TAG_PERIOD,      TAG_MON,       TAG_TUE,      TAG_WED,
             TAG_THU, TAG_FRI},
                                 new int[]{R.id.period, R.id.mon, R.id.tue, R.id.wed, R.id.thu, R.id.fri} //
             TextView   추가
                         );


                                                        - 868 -
   863   864   865   866   867   868   869   870   871   872   873