title: Use Volley synchronous
body: <p>I need to use volley sync (need to get server response then continues program)</p>
  
  <p>I search a lot in stackOverFlow but i have problem with them
   this is my code</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_splash);
  
      //For ByPass Test
      new Handler().postDelayed(new Runnable(){
          @Override
          public void run() {
              Initials();
          }
      }, SPLASH_DISPLAY_LENGTH);
  }
  
  private void Initials(){
      String url = AppController.getInstance().getMainUrl() + "GetVer";
      String response = new String();
      RequestQueue requestQueue = Volley.newRequestQueue(this);
  
      RequestFuture&lt;JSONObject&gt; future = RequestFuture.newFuture();
      JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, new JSONObject(), future, future);
      requestQueue.add(request);
  
      try {
          response = future.get().toString();
      } catch (InterruptedException e) {
          e.printStackTrace();
      } catch (ExecutionException e) {
          e.printStackTrace();
      } catch (TimeoutException e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>but when i debug program my app Block on this line</p>
  
  <pre><code>response = future.get().toString();
  </code></pre>
  
  <p>and i add timeout to this line but it will go to <code>TimeoutException</code></p>
  
  <pre><code>catch (TimeoutException e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>after define time </p>
  
  <p>i trace volley request on Logcat and request done with out any error</p>
  
  <p>this is volley logcat</p>
  
  <pre><code>02-04 22:08:12.171 28508-28553/? D/Volley: [2249] bjk.b: new request, sending to network 1-https://safebrowsing.google.com/safebrowsing/clientreport/download
  02-04 22:08:12.381 17530-17637/ir.onecloud.elearning V/Volley: [2674] CacheDispatcher.run: start new dispatcher
  02-04 22:08:12.586 17530-17637/ir.onecloud.elearning D/Volley: [2674] WaitingRequestManager.maybeAddToWaitingRequests: new request, sending to network http://shokribozorg.ir/WebService/WebService.asmx/GetVer
  02-04 22:08:12.776 17530-17638/ir.onecloud.elearning D/Volley: [2675] BasicNetwork.logSlowRequests: HTTP response for request=&lt;[ ] http://shokribozorg.ir/WebService/WebService.asmx/GetVer 0x81eb498 NORMAL 1&gt; [lifetime=176], [size=1], [rc=200], [retryCount=0]
  02-04 22:08:12.881 28508-28558/? D/Volley: [2255] bkm.a: HTTP response for request=&lt;[ ] https://safebrowsing.google.com/safebrowsing/clientreport/download 0xc9395b26 NORMAL 7&gt; [lifetime=709], [size=263], [rc=200], [retryCount=0]
  02-04 22:08:12.886 28508-28508/? D/Volley: [1] bkh.a: (716  ms) [ ] https://safebrowsing.google.com/safebrowsing/clientreport/download 0xc9395b26 NORMAL 7
  02-04 22:08:12.886 28508-28508/? D/Volley: [1] bkh.a: (+0   ) [2244] add-to-queue
  02-04 22:08:12.886 28508-28508/? D/Volley: [1] bkh.a: (+0   ) [2249] cache-queue-take
  02-04 22:08:12.886 28508-28508/? D/Volley: [1] bkh.a: (+1   ) [2249] cache-miss
  02-04 22:08:12.886 28508-28508/? D/Volley: [1] bkh.a: (+1   ) [2255] network-queue-take
  02-04 22:08:12.886 28508-28508/? D/Volley: [1] bkh.a: (+709 ) [2255] network-http-complete
  02-04 22:08:12.886 28508-28508/? D/Volley: [1] bkh.a: (+4   ) [2255] network-parse-complete
  02-04 22:08:12.886 28508-28508/? D/Volley: [1] bkh.a: (+0   ) [2255] post-response
  02-04 22:08:12.886 28508-28508/? D/Volley: [1] bkh.a: (+1   ) [ 1] done
  02-04 22:08:16.631 18005-18039/? V/Volley: [2785] CacheDispatcher.run: start new dispatcher
  </code></pre>