title: Android - Return value get in a custom listener
body: <p>Please excuse my french english !</p>
  
  <p>So, I have got a problem in my Android code...
  I call a method which much return a arrayList of a custom object... but this arrayList is loaded asynchronously and returned in a listener.</p>
  
  <p>Do you know how I could return datas when the method of my listener is called ?</p>
  
  <p>Here my code :</p>
  
  <pre><code>    public static ArrayList&lt;Advert&gt; getAdverts(Context context) {
      // Initialize
      RestHelper restHelper = new RestHelper();
  
      // Set the listener
      restHelper.setOnRestListener(new OnRestListener&lt;Advert&gt;() {
          @Override
          public void onDataAvailable(ArrayList&lt;Advert&gt; result) {
              // -- Datas are loaded : now we must return them ! --
          }
      });
  
      // Launch the async query
      restHelper.getRemoteAdverts();
      }
  </code></pre>
  
  <p>Thanks !!</p>