I'm getting a valid JSON response from server
{
"id": "3456789912",
"desa": "Lilangan",
"kecamatan": "Gantung"
}
I want to show json object result in text view, when I click the button to run, but the text view stays empty.
Here java method to parse JSON:
private void jsonParse() {
String userID = noResi.getText().toString();
String url= "http://192.168.1.123/api/json.php?id="+userID;
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null,
new Response.Listener<JSONObject>(){
public void onResponse(JSONObject response){
try {
String desa = response.getString("desa");
String kec = response.getString("kecamatan");
tvKeterangan.append("Desa "+desa+"\nKecamatan "+kec); //This is text view to show the result
} catch (JSONException e) {
e.printStackTrace();
}
}
}, Throwable::printStackTrace);
mQueue.add(request);
}
Exception:
java.io.IOException: Cleartext HTTP traffic not permitted