I have the following code.
As you can see the method postTestResults
should return a Boolean.
Now the problem is that in postTestResults
I create a inner class AsyncHttpResponseHandler
and I override onSuccess
and onFailure
to get the result of the AsyncHttpResponseHandler.
BUT if I put return true in onSuccess
and onFailure
obviously it does not work, because onSuccess
and onFailure
must return void.
Please how do I cope with such a scenario?
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;
}
Thanks