i am working with instagram API in that i have use ion lib for API request my question is how to handle multiple request's response using my code like this
public class UserProfileActivity extends AppCompatActivity implements
FutureCallback {
:
:
Ion.with(context)
.load("http://example.com/test1")
.asString()
.setCallback(this);
Ion.with(context)
.load("http://example.com/test2")
.asString()
.setCallback(this);
@Override
public void onCompleted(Exception exception, String response) {
}
}
//and i don't want to use like this (anonymous class )
Ion.with(context)
.load("http://example.com/thing.json")
.asJsonObject()
.setCallback(new FutureCallback() {
@Override
public void onCompleted(Exception e, JsonObject result) {
// do stuff with the result or error
}
});
in this case if i am requesting 2 request test1 and test2 how can i differentiate 2 request response in one callback
and Same thing with Volley also
EDIT
any help on multi treading in android ?