I am trying to get a more specific result than what I am currently getting. Here is my code:
// Request a string response from the provided URL.
JsonObjectRequest jsObjRequest = new JsonObjectRequest
(Request.Method.GET, url, (String)null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
JSONObject city = response.getJSONObject("city ");
mTextView.setText("" + city.toString());
}
catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
mTextView.setText("That didn't work!");
}
});
mRequestQueue.add(jsObjRequest);
}
Here is a screenshot of what I get in return :
More specifically, I'm just trying to get the city name when the JSON value is returned. How can I do this?