Answer the question
In order to leave comments, you need to log in
How to wait for callback to finish?
Есть код
MyTwitterSession.getInstance().setSession(result);
TwitterSession session = MyTwitterSession.getInstance().getSession();
new MyTwitterApiClient(session).getStatusesService().userTimeline(null, session.getUserName(), 10, null, null, null, null, null, null, new Callback>() {
@Override
public void success(Result> result) {;
MyTwitterSession.getInstance().setTweets(result.data);
}
@Override
public void failure(TwitterException e) {
}
});
MyTwitterSession is a singleton class. How can I wait for the callback to complete? At the time when it is necessary to use a field from a singleton class, it is null.
Answer the question
In order to leave comments, you need to log in
if I understand the question correctly, then you do not understand the essence of asynchronous task execution.
No way.
It doesn't depend on you when the request is executed, you just handle the result of success/failure
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question