1

I have simple volley request below. I want to fetch data from cache first, load the screen with this cache data after when fetching data from service, load same screen again.

RequestQueue queue = Volley.newRequestQueue(this);
        StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
                (Response.Listener<String>) response -> {
            //success
                }, (Response.ErrorListener) error -> {
            //error
                });

        queue.add(stringRequest);

Is there any simple way.

6155031
  • 4,171
  • 6
  • 27
  • 56

1 Answers1

-1

Please note that if the web service supports caching output, you don't have to use CacheRequest below, because Volley will automatically cache.

try this.

https://stackoverflow.com/a/32022946/6155031