title: Volley , Wait for response to return wait until use flag
body: <p>I have to respond to result of volley request. but because it is asynchronous. I need to wait for the results before I proceed. If I don't I will get nullobjects.</p>
  
  <p>How do I set flags and wait until flags are off. </p>
  
  <pre><code> categoryslashid = new JSONObject[Category_IDs.size()];//size of the list containing all categories   
  
      taskfinished = new boolean[Category_IDs.size()];
  
      //boolean is initialized to false
      //Request to category/{id} to get 
      for(int i= 0;i&lt;Category_IDs.size();i++)
      {              makevolleyrequesforCategorySlashID(Const.URL_FULL_STOREURL+Const.URL_PRODUCT_GET_CATEGORY_ID,i);
      }
  public void makevolleyrequesforCategorySlashID(URL,id)
  {
  //volley implementation
  public void onResponseoverride
  {
  categoryslashid[i]=response;
  taskfinished[i]=true;
  }
  
  }
  </code></pre>
  
  <p>Now I must proceed after I get all the booleans in task finished become true.</p>
  
  <pre><code>public  boolean areAllTrue()
      {
  
          for(boolean b : taskfinished) if(!b) return false;
          return true;
      }
  </code></pre>