TokenCache class is passed to Facebook class to do save() and load() tokens. TokenCache has these functions:
public abstract void save(Bundle bundle);
public abstract Bundle load();
Now I want to do that saving and loading in multiple threads, so I run a AsyncTask in load(). The problem is it was already designed to return a Bundle! How to implement it so that the value only returned when the AsyncTask finishes?
Simply have a field of Bundle in your TokenCache implementation that your load() method returns. Just make sure you don’t yet pass a reference to the TokenCache to FB until that Bundle is initialized by some init(bundle) method, e.g.