i am trying to get JSON values from server. I don\'t know what is wrong with my code. I am using AsyncTask
and here is my code in doInBackground
The reason why you get this error is because you attempt to access the response more than once. For example lets lets say you do a log with the response, then create a json object with the same response object, it will trigger this one time acees error.
You are probably getting a blank response. Its not null but the jsontext is empty. So you are getting this error and not a Nullpointer exception
Are you sending right parameters to server.Also Check url respond to POST requests or not.
Check if the response is not empty before process the JSON:
if (response.success()) {
if (response.getData() == null) {
return null;
} else if (response.getData().length() <= 0){
return null;
}
try {
// Logic