Page 284 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 284
private boolean isReady; //정보가 입력됬는지 확인
하는 변수
private String state = "";
public String getShareDatea() { //정보 반환
return state;
}
public void setSharedData(String sharedData) { //정보 셋팅
state = sharedData;
}
public boolean getIsReady() { //정보 반환
return isReady;
}
public void setIsReady(boolean isReady) { //정보 셋팅
this.isReady = isReady;
}
}
public void Update() {
try {
String urlAddr =
"http://openapi.airkorea.or.kr/openapi/services/rest/ArpltnInforInqireSvc/getCtprvnMesureSidoL
Ist?sidoName=%EC%9D%B8%EC%B2%9C&searchCondition=DAILY&pageNo=1&numOfRows=10&Serv
iceKey=gT8%2BgqEG%2BWICWvR2uFLIONs%2FgKj5EYm8D%2Fa5bmSBq5HOcCf1NxZIuSF%2FRJEq7
HIIi8nQMOmCR6%2BPH%2BYI4geQPA%3D%3D";
URL url = new URL(urlAddr);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
//Http 프로토콜을 통해 통신하는 소스
if (conn != null) {
conn.setConnectTimeout(20000);
conn.setUseCaches(false);
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
InputStreamReader isr = new InputStreamReader(conn.getInputStream());
BufferedReader br = new BufferedReader(isr);
- 277 -