I'm creating this method / function and I need to implement callback. I mean, I need to add as dynamic argument, a function. I have read several articles but I can not understand how to get it. Any idea or example of use?
public void httpReq (final String url, final Object postData, String callbackFunct, Object callbackParam,String callbackFailFunct) {
if (postData == null || postData == "") {
//GET
Thread testGET = new Thread(new Runnable() {
@Override
public void run() {
StringBuilder builder = new StringBuilder();
HttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(url);
....
}
}
} else {
//POST
Thread testPOST = new Thread(new Runnable() {
@Override
public void run() {
HttpGet httpPost = new HttpPost(url);
....
}
}
}
}