use of im.amomo.volley.OkRequest in project OkVolley by googolmo.
the class RequestFragment method load.
private void load() {
OkRequest request = new BaseRequest(Request.Method.GET, "https://api.douban.com/v2/user/googolmo", new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject jsonObject) {
Toast.makeText(getActivity(), jsonObject.toString(), Toast.LENGTH_SHORT).show();
Toast.makeText(getActivity(), jsonObject.optString("name"), Toast.LENGTH_SHORT).show();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getActivity(), error.getMessage(), Toast.LENGTH_SHORT).show();
}
});
request.setTag("request");
OkVolley.getInstance().getRequestQueue().add(request);
}
Aggregations