title: How to return value from anonymous class?
body: <p>I have the following code.</p>
  
  <p>As you can see the method <code>postTestResults</code> should return a Boolean.</p>
  
  <p>Now the problem is that in <code>postTestResults</code> I create a inner class <code>AsyncHttpResponseHandler</code> and I override <code>onSuccess</code> and <code>onFailure</code> to get the result of the AsyncHttpResponseHandler.</p>
  
  <p>BUT if I put <strong>return true</strong> in <code>onSuccess</code> and <code>onFailure</code> obviously it does not work, because <code>onSuccess</code> and <code>onFailure</code>must return <strong>void</strong>.</p>
  
  <p>Please how do I cope with such a scenario?</p>
  
  <pre><code>public static Boolean postTestResults(DBManager db, String mDeviceId,
      String mFirmwareVer, String mJobNo, int mTestType, Activity activity) {
  
      MyRestClient.post(possibleEmail, device, results, new AsyncHttpResponseHandler() {
  
          @Override
          public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
              return true; // does not work!              
          }
  
          @Override
          public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
              // TODO Auto-generated method stub
  
          }
      });
  
      return null;
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/QM4Ux.jpg" alt="enter image description here"></p>
  
  <p>Thanks</p>