Page 296 - 3-3
P. 296

//InputStream  생성
                                  bufferedReader            =           new            BufferedReader(new
            InputStreamReader(con.getInputStream()));


                                  //StringBuilder 로 받아온 문자열을 저장하는 변수
                                  String json;
                                  // 받아온 문자열이 null     이 아닐때 반복
                                  while ((json = bufferedReader.readLine()) != null) {
                                      // 문자열 줄바꿈문자 받아오기+
                                      sb.append(json + "\n");
                                  }


                                  // 공백을 제거하고 출력하기
                                  return sb.toString().trim();
                              }
                              // 예외 발생시
                              catch (Exception e) {
                                  //null  출력
                                  return null;
                              }
                          }


                          @Override
                          // 스레드 작업이 끝나면 동작
                          protected void onPostExecute(String result) {
                              // 결과값 출력
                              myJSON = result;
                              // 리스트 띄우기
                              showList();
                          }
                      }
                      //http url 을 불러오기 위한 객체 생성
                      GetDataJSON g = new GetDataJSON();
                      g.execute(url);
                  }
              }


              타) DB7.java
              package layout;


              // 불러올 클래스들을 import       해준다
              import android.content.Context;
              import android.content.Intent;
              import android.os.AsyncTask;
              import android.os.Bundle;


                                                        - 296 -
   291   292   293   294   295   296   297   298   299   300   301