title: Android volley last request post call on network drop?
body: <p>Volley works well when there is network but it goes weird when network drops.</p>
  
  <p>When network is doping ie network strength is going down and i make a post request then nothing happens but once the network regain to full strength it makes the call to the previous post request not the new one?</p>
  
  <p>when i clear the cache it works well...</p>
  
  <p>how to solve this issue, why i am getting previous post response?</p>
  
  <pre><code>// Implements required listeners
  public class VolleyServices&lt;T&gt; implements Response.Listener&lt;T&gt;, ErrorListener{
  
  private int id; // request id
  private RequestQueue request; // volley request queue
  private VolleyResponce&lt;T&gt; listener; // callback listener
  private Class&lt;T&gt; clazz;  // parsing class
  
  public interface VolleyResponce&lt;T&gt; {
      public void OnSuccess(T response,int id);
      public void OnError(ServerError error,int id);
  }
  
  // Constructor
  public VolleyServices(VolleyResponce&lt;T&gt; listener,Context context) {
      this.listener = listener;
      request = VolleyRequest.getInstance(context).getRequestQueue();
  }
  
  // call to post the request with parse class, post parameters in map and request id
  public void post(String methodName, HashMap&lt;String, String&gt; map,Class&lt;T&gt; clazz,int id) {
      String url = baseUrl + methodName;
      this.clazz = clazz;
      this.id = id;
      GsonRequest&lt;T&gt; myReq = new GsonRequest&lt;T&gt;(Request.Method.POST,url,clazz,map,this,this);
      myReq.setTag(id);
      request.add(myReq);
  }
  
  @Override
  public void onResponse(T response) {
      if(response != null &amp;&amp; clazz == response.getClass()){               
          listener.OnSuccess(response,this.id);                               
      }       
  }
  
  @Override
  public void onErrorResponse(VolleyError volleyError) {
  
      ServerError error = null;
  
      if(volleyError instanceof NetworkError) {
          error = new ServerError("No internet Access, Check your internet connection.","400");
      }
  
      if(volleyError instanceof AuthFailureError) {
          error = new ServerError("Authentication Failure","400");
      }
  
      if(volleyError instanceof ParseError) {
          error = new ServerError("Parsing error","400");
      }
  
      if(volleyError instanceof NoConnectionError) {
          error = new ServerError("No internet Access, Check your internet connection.","400");
      }
  
      if(volleyError instanceof TimeoutError) {
          error = new ServerError("Request timed out, Please try again later.","400");
      }
  
      if(volleyError.networkResponse != null &amp;&amp; volleyError.networkResponse.statusCode == 500) {
          error = new ServerError("Internal server error","400");
      }
  
      else {
          try {
              if(volleyError.networkResponse != null) {
                  String responseBody = new String(volleyError.networkResponse.data, "utf-8" );
                  try{
                      Gson gson = new Gson();         
                      error = gson.fromJson(responseBody, ServerError.class);
                      if(error.status == null) {
                          error.status = "";
                      }
                  }catch(Exception e){
                      e.printStackTrace();
                  }
              } else {
                  error = new ServerError("Unknown Error","400");
              }
          } catch (UnsupportedEncodingException e) {
              e.printStackTrace();
          }
      }
      listener.OnError(error,this.id);
  }
  </code></pre>
  
  <hr>
  
  <p>Some log message i captured which explains everything in detail
  <a href="http://pastebin.com/0shpUnZi" rel="nofollow">log link</a></p>