Org.json.jsonexception: End Of Input At Character 0 Of, Android
I am implementing an android app and trying to make a register and login screens. my app is connected to a server, here is the part my code that makes error: public void onResponse
Solution 1:
As you have seen in your logcat 1576-1576/com.example.neshat.androidhive2 D/RegisterActivity﹕ Register Response:
which is the result of Log.d(TAG, "Register Response: " + response.toString());
, response
is an empty string, so your app will get org.json.JSONException: End of input at character 0 of
at the line JSONObject jObj = new JSONObject(response);
.
You should check response
is not null and not an empty string first.
Solution 2:
If you are using php to get the response, you should check on your php file. I had the same problem as you, i forgot to write the response on my php file. Below is part of my code that i forgot
$response = new emp();
$response->success = 1;
$response->message = "Register success, please login.";
die(json_encode($response));
Post a Comment for "Org.json.jsonexception: End Of Input At Character 0 Of, Android"