1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, new Response.Listener<JSONObject>()
{
@Override
public void onResponse(JSONObject response)
{
onResponse();
// Log.d("APP", response.toString());
try {
JSONObject json = response.getJSONObject(name.toLowerCase());
String name = json.getString("name");
long id = json.getLong("id");
callback.onSuccess(name, id);
} catch (JSONException e) {
Log.d("APP", "EXCEPTION =" +e);
e.printStackTrace();
}
}
} |
Partager