-
Notifications
You must be signed in to change notification settings - Fork 0
Home
EZ-volley is the simple android project that you can understand how to use Volley Libs to make request with your API.
We have
- VolleySingleton.class A Singleton class.
- VolleyRequest.class Static class to call an API.
- VolleyResponseListener.class Handle callback from response.
In VolleyRequest.class we have the static method
public static void getArrayRequest(String url, final VolleyResponseListener listener){}
This method will call to API that return JSONArray with HTTP method GET.
public static void getObjectRequest(String url, JSONObject body, final VolleyResponseListener listener){}
This method will call to API that return JSONObject with HTTP method GET.
public static void postObjectRequest(String url, JSONObject body, final VolleyResponseListener listener){}
This method will call to API that return JSONObject with HTTP method POST.
public static void putObjectRequest(String url, JSONObject body, final VolleyResponseListener listener){}
This method will call to API that return JSONObject with HTTP method PUT.
public static void deleteRequest(String url, final VolleyResponseListener listener) {}
This method will call to API with HTTP method DELETE.
public static void putStringRequest(String url, final VolleyResponseListener listener) {}
This method will call to API that return JSONObject with HTTP method PUT.
** To prevent call to API multiple time or duplicate call when slow internet connection, we set RetryPolicy to
jsonArrayRequest.setRetryPolicy(new DefaultRetryPolicy(0, -1, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));