class CheckId extends AsyncTask<String, String, String> {
private Dialog dialog;
private String mchkid;
@Override
protected void onPreExecute() {
dialog = ProgressDialog.show(Login.this, "", "잠시만 기다려주세요..");
dialog.setCancelable(false);
}
@Override
protected String doInBackground(String... arg0) {
StringBuilder html = new StringBuilder();
try {
HttpURLConnection conn = (HttpURLConnection) new URL(
"URL")
.openConnection();
if (conn != null) {
conn.setConnectTimeout(10000);
conn.setUseCaches(false);
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line = br.readLine();
if (line == null) {
}
html.append(line + '\n');
while (true) {
line = br.readLine();
if (line == null) {
break;
}
html.append(line + '\n');
}
br.close();
}
conn.disconnect();
checked = html.toString();
}
} catch (Exception e) {
e.printStackTrace();
}
return checked;
}
@Override
protected void onPostExecute(String arg0) {
try {
JSONArray ja = new JSONArray(checked);
for (int i = 0; i < ja.length(); i++) {
JSONObject order = ja.getJSONObject(i);
if (order.getString("id").equals(id)) {
if (order.getString("pass").equals(pass)) {
}
} catch (Exception e) {
e.printStackTrace();
}
dialog.dismiss();
}
}
4.1.2 버전 이나 4.3 버전 에선 문제 없이 돌아 가는데 2.3.4 버전으로 돌리면 JSONException 이 나는데
무슨 이유인지 모르겠네요..
04-02 14:30:53.879: D/checked(7724): <!>com.login.Login$CheckId 204<!> [{"id":"id","pass":"pass","nickName":"\uadc0\uc5fc\uc219\uc815","MyDeviceId":"11111111111","flag":null},
파싱 해온것도 잘 오고 있구요..