Volley で同期的にリクエストを実行する
Volley  は Android のネットワーク処理をいい感じに非同期で行ってくれる。とても便利だけど時々同期的に実行したい時がある。SyncAdapter の中とか。RequestFuture を使って以下のようにすれば非同期呼び出しが終わるまで待つことができる。       public void someMethod() throws ExecutionException, InterruptedException {         RequestFuture<String> future = RequestFuture.newFuture();         StringRequest request = new StringRequest(URL, future, future);         RequestQueue queue = Volley.newRequestQueue(getContext());         queue.add(request);         String result = future.get();// 非同期呼び出しを join する         // result でなんかする     }   参考   Can I do a synchronous request with volley? - Stack Overflow