I am looking for something like following code. I know the code below is obviously wrong, I just want to make it clear that what I am looking for.
private HttpRequest httpRequest;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// instiantiate the httpRequest
httpRequest = HttpRequest.init();
httpRequest.get("http://www.example.com", HttpRequest.callbackFunction(){
@Override
public void Result(String err, String recv){
// done something here
}
});
}
** Must works in background and implement with callback function
** It must be able to be called multiple times on single activity. AsyncTask is not the things I want.
** I don't mind open source library. As long as it achieved what I needs