Your condition is wrong.
if (jsonObject == null) {
Log.i("log", "the json object is not null");
// this part is showing everytime.
} else {
Log.i("log", "the json object is null");
}
jsonObject == null
is checking if it’s null. If it is true, it will go through the the block, else
otherwise. I think you intend to reverse the condition.
1
solved JSON object can not be inintialised [closed]