내 안드로이드 앱의 URL에서 데이터를 가져 오려고합니다. Get/Post 요청에 발리 라이브러리를 사용하고 있습니다. 내 코드는 다음은 URL의 컨텐츠를 얻을 수 있습니다 :JSON 구문 분석 중에 JSONexception을 throw 할 수 없습니다.
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest( Request.Method.GET, R.string.login, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
Intent intent = new Intent(LoginActivity.this, HomeActivity.class);
startActivity(intent);
finish();
} catch (JSONException e) {
e.printStackTrace();
Log.e("ex","Exception Caught! "+e);
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
RequestQueue requestQueue = Volley.newRequestQueue(this);
requestQueue.add(jsonObjectRequest);
하지만 JSONException에 오류가 다음 무엇입니까 :
예외 org.json.JSONexception이 try 블록 대응에 던져되지 않습니다
누군가 나를 도울 수 있습니까?
감사
판 카지
수정이 아니라 좀 더 나은 답을 포맷하는 것이 처리합니다. – basic
그래, 내가 그랬어. 게시 한 후 내 서식을 보았습니다. :디 – Rohit5k2