Page 857 - 3-3
P. 857

new String[]{TAG_Status}, //   리스트에 들어갈 내용 추가
                                   new int[]{R.id.Te_info} // TextView  추가
                           );
                           list.setAdapter(adapter); //  리스트 어댑터를 불러옴
                       } catch (JSONException e) {
                           e.printStackTrace();
                       }
                   }
                   // JSON  파싱
                   protected void showList4() {
                       try {
                           JSONObject jsonObj = new JSONObject(myJSON4);// JSON       생성
                      peoples = jsonObj.getJSONArray(TAG_JSON4); // TAG_JSON         값과 일치하는 DB       값을 불
               러옴
                           //  상태값을 받아옴
                           for (int i = 0; i < 1; i++) {
                               JSONObject c = peoples.getJSONObject(i);
                               String status = c.getString(TAG_Status); // TAG_Status 값을 불러옴
                               HashMap<String, String> persons = new HashMap<String, String>();
                               persons.put(TAG_Status, status);
                               personList.add(persons); //  리스트에 추가
                           }
                           final ListAdapter adapter = new SimpleAdapter(
                                   Office_menu.this,   personList,   R.layout.item_list3,  //  List 를  작성할
               TextView  가 있는 xml   를 불러옴
                                   new String[]{TAG_Status}, // TAG_Status    추가
                                   new int[]{R.id.Te_info} // TextView  추가
                           );
                           list.setAdapter(adapter); //  리스트 어댑터를 불러옴
                       } catch (JSONException e) {
                           e.printStackTrace();
                       }
                   }
                   // http 통신을 하여 PHP     에서 데이터를 가져옴
                   public void getData(String url) {
                       class GetDataJSON extends AsyncTask<String, Void, String> {
                           @Override
                           protected String doInBackground(String... params) {
                 String uri = params[0];
                               BufferedReader bufferedReader = null;
                               try {
                                   URL url = new URL(uri); // url  객체 생성
                                   HttpURLConnection con = (HttpURLConnection) url.openConnection(); //
               주소를 열어줌
                                   StringBuilder sb = new StringBuilder(); //  문자열을 받아올 객채 생성


                                                          - 857 -
   852   853   854   855   856   857   858   859   860   861   862