title: Android-volley: how do I take the String response value and assign it outside of a volley StringRequest method?
body: <p>The data appears as expected when I run the method in the debugger, however whenever I try to do anything with it the value of parentObject is returned as null.</p>
  
  <p>I simply want to take the response from the server and store it as a JSONObject to be reused elsewhere.</p>
  
  <pre><code>public void jsonParse() {
      String url = "http://178.128.166.68/getUserInfo.php";
  
      StringRequest request = new StringRequest(Request.Method.POST, url,  new Response.Listener&lt;String&gt;() {
          @Override
          public void onResponse(String response) {
              try {
                  /*
                  the data appears as expected within the debugger however
                   returns null when i attempt to use it elsewhere
                   */
                  parentObject = new JSONArray(response);
  
              } catch (JSONException e) {
                  e.printStackTrace();
              }
          }
      }, new Response.ErrorListener() {
          @Override
          public void onErrorResponse(VolleyError error) {
  
          }
      }) {
          @Override
          protected Map&lt;String, String&gt; getParams() {
              Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
              params.put("phone", phone);
              params.put("password", password);
  
              return params;
          }
      };
      mQueue.add(request);
  
  
  }
  </code></pre>