-
Notifications
You must be signed in to change notification settings - Fork 545
getDataFromCache(...) not working #30
Comments
Could you post a simple project that reproduces this? |
You can reproduce this issue with:
@Override
protected void onResume() {
super.onResume();
ListTweets tweets;
try {
Future<ListTweets> task = contentManager.getDataFromCache(ListTweets.class, "tweets.android");
tweets = task.get();
} catch (CacheLoadingException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
} 4 search with the query "android" |
Was you spiceManager started before reaching this line ? Also, please consider the asynchronous nature of a call to When you call the method get() of that future, it will block until the Stéphane 2013/1/19 papo2608 notifications@github.com
Stéphane NICOLAS, |
I was writing what @stephanenicolas said. BTW, you can use the |
Right. Thx Ricardo. ;) 2013/1/19 Riccardo Ciovati notifications@github.com
Stéphane NICOLAS, |
OK, so there is no possibility to get cached data synchronously? |
I tried to use getDataFromCache(final Class clazz, final String cacheKey) in onResume of an activity but the app ends in an ANR error.
The SpiceManger was started in onStart. I figured out that the service is never connected in this case (onServiceConnected isn't called) and so waitForServiceToBeBound ends in an infinite loop.
Can you please tell me whats the right time/place to call getDataFromCache?
The text was updated successfully, but these errors were encountered: