title: How to update variable on parseNetworkResponse method in android volley?
body: <p>I am attempting to delete something from my back end and I need to update my android UI depending on if the delete is successful or not based on the API's HTTP Status code.</p>
  <p>So,
  I have created member variable for the current FragmentActivity like this,</p>
  <pre><code>private int deleteStatus;
  </code></pre>
  <p>and initialized with the value of zero on <code>public void onCreate</code> method.</p>
  <p>Now, I make a Restful API call do delete an object</p>
  <pre><code>public int handleDeletePet(int petId) {
  
  
          String url = &quot;http://10.0.2.2:8080/api/myurl/&quot;;
  
          JsonObjectRequest request = new JsonObjectRequest(Request.Method.DELETE, url + petId, null, new Response.Listener&lt;JSONObject&gt;() {
              @Override
              public void onResponse(JSONObject response) {
              }
          }, new Response.ErrorListener() {
              @Override
              public void onErrorResponse(VolleyError error) {
                  error.printStackTrace();
              }
          }){
              @Override
              protected Response&lt;JSONObject&gt; parseNetworkResponse(NetworkResponse response) {
                  Log.i(&quot;status code is &quot;, String.valueOf(response.statusCode));
                  if(response.statusCode == 200) {
                      deleteStatus = 200;
                      Log.i(&quot;updated_status &quot;, String.valueOf(deleteStatus));
  
                  } else {
                      deleteStatus = 403;
                      Log.i(&quot;failed&quot;, String.valueOf(response.statusCode));
                  }
                  return super.parseNetworkResponse(response);
              }
  
          };
          MySingletonRequestQueue.getInstance(this.getActivity()).addToRequestQueue(request);
          Log.i(&quot;final delete status&quot;, String.valueOf(deleteStatus));
          
  
      return deleteStatus;
  }
  </code></pre>
  <p>Now, the app is returning the correct status codes in the console (200 or 403) but when I see the log of <code>final delete status</code>, I still see 0 but for <code>updated_status</code> the value is 200. Why is the value for <code>deleteStatus</code> not being updated? Is this a logical error?</p>