title: Android: Volley String request onresponse is not called
body: <p>I am trying to send data from android to php using POST method</p>
  
  <p>the php part is tested alone and it's 100% working and it returns a json string as supposed</p>
  
  <p>the android part isn't working
  it doesn't print error
  or even the required response</p>
  
  <p>Here is the code and it's tested , printing a string "test" using Toast , but it doesn't change in the volley code :(</p>
  
  <p>this is the php code:</p>
  
  <pre><code>&lt;?php
      require_once(__DIR__.'/../dbConnect.php');  
  
  
      $userName=$_POST['username']; 
  
      $query = "SELECT * FROM users WHERE username='$userName'";
      $result = pg_query($con, $query);
      $rows = pg_num_rows($result);
  
      while ($row = pg_fetch_row($result)) 
      {
          $field = pg_num_fields( $result );
  
          for ( $i = 0; $i &lt; $field; $i++ ) {
  
              $name = pg_field_name( $result, $i );
              $user_arr[$name] = $row[$i]; 
          }               
      }
  
      echo json_encode($user_arr);
  
      pg_close($con); 
  
      ?&gt;
  </code></pre>
  
  <p>and this is android code:</p>
  
  <p>initializing the test string to display output</p>
  
  <pre><code>String test = "none";
  </code></pre>
  
  <p>this is where I call the method </p>
  
  <pre><code>  setUserData(username);
    Toast.makeText(LoginActivity.this, test, Toast.LENGTH_SHORT).show();
  </code></pre>
  
  <p>and this is the method:</p>
  
  <pre><code>  private void setUserData(final String username)
      {
          StringRequest strReq = new StringRequest(Request.Method.POST,
                  Server.GET_USERDATA_URL, new Response.Listener&lt;String&gt;() {
  
              @Override
              public void onResponse(String response) {
  
                     test= "test = "+response;
  
              }
          }, new Response.ErrorListener() {
  
              @Override
              public void onErrorResponse(VolleyError volleyError) {
                  Toast.makeText(LoginActivity.this, volleyError.getMessage().toString(), Toast.LENGTH_LONG).show();
  
              }
          })
  
          {
  
              @Override
              protected Map&lt;String, String&gt; getParams() {
                  // Posting parameters to getData url
                  Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
                  params.put(Server.KEY_USERNAME, username);
                  return params;
              }
  
          };
          //Creating a Request Queue
          RequestQueue requestQueue = Volley.newRequestQueue(this);
          //Adding request to the queue
          requestQueue.add(strReq);
      }
  </code></pre>