마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

2.3.4 에서 JSONException 이요 ㅠ

0 추천
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},
파싱 해온것도 잘 오고 있구요.. 

 

숀화이트 (3,310 포인트) 님이 2014년 4월 2일 질문

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...