Questions tagged [asynctaskloader]

AsyncTaskLoader is an Android Loader that uses an AsyncTask to do the loading of data in a background thread.

The AsyncTaskLoader, like other types of Android Loaders, is a class that can be used to avoid having to load data on the main UI thread(loading which may block the UI thread and the app itself). The AsyncTaskLoader was introduced in the Android SDK starting with API level 11(Honeycomb) but is available in older versions through the Android compatibility package. More information about the AsyncTaskLoader along with examples of using one can be found in the documentation for the class.

199 questions
2
votes
3 answers

loadinBackground() called during configuration Change

I'm making an application which shows a list of zipcodes( in ListView) and when I click on it, it shows me detailed weather report using OpenWeather API. The list of zipcodes are stored in SQLite database and to retrieve data from it, I'm using…
user2430771
  • 1,326
  • 4
  • 17
  • 33
2
votes
0 answers

Loader's onLoadFinished() on adjacent pages not called until view is recreated

I am having difficulty implementing loaders properly. I read a lot of articles and stackoverflow posts, and tried various things. But nothing has solved this problem yet. I am using a viewpager with PagerSlidingTabStrip library to create a 3 tab…
enigma9119
  • 31
  • 5
2
votes
2 answers

onLoadFinished called when I click back button from othe Activity

I try to work with AsyncTaskLoader and I have one problem. I load in AsyncTaskLoader data from the internet then start other activity(BusModelsActivity) in method onLoadFinished @Override public void…
Abbath
  • 1,002
  • 13
  • 30
2
votes
2 answers

AsyncTaskLoader for http requests to handle orientation changes, using generics, inheritance

Currently I am using an asynchronous http library to execute http requests against our server. However this carries the problem where if an http call is in progress during a screen rotation we will have a reference to the old context when the call…
Matt Wolfe
  • 8,924
  • 8
  • 60
  • 77
2
votes
1 answer

Very Basic LoaderTestCase stuck in getLoaderResultSynchronously

I am new to Loaders and am trying to test the most basic AsyncTaskLoader in a LoaderTestCase. However getLoaderResultSynchronously never finishes. This ist the whole class: public class LoaderTest extends LoaderTestCase{ public void…
Kuno
  • 3,492
  • 2
  • 28
  • 44
2
votes
1 answer

Use different (AsyncTask) Loaders in one Activity

I want to use different AsyncTaskLoaders (different in their return type) in my Activity, what's the best way to implement the callback methods? This won't work: public class MyActivity extends Activity implements …
fweigl
  • 21,278
  • 20
  • 114
  • 205
2
votes
2 answers

Android Use of AsyncTaskLoader in a Service

I need to make a design decision. From what I read in the android developers site I think I want to implement a Service which launches an AsyncTaskLoader to load data from an OS process in the background. In the android developers site documentation…
ilomambo
  • 8,290
  • 12
  • 57
  • 106
2
votes
1 answer

How Does AsyncTaskLoader Cache Data?

I have an activity which implements a fragment where all of this code lives. This is best explained through an example as the code is confidential. This example mirrors what is trying to be done and what I observed through testing ex.) I have a rss…
Zachary Moshansky
  • 1,673
  • 18
  • 32
2
votes
2 answers

CursorLoaders and AsyncTaskLoaders using same LoaderManager

I have a fragment that uses multiple CursorLoaders. All works fine. Now I need to add an AsyncTaskLoader as well, to the same fragment. Question is, how can I use the same LoaderManager.LoaderCallbacks interface to manage both my CursorLoaders and…
drod
  • 359
  • 5
  • 17
1
vote
0 answers

Is it possible to find out if the LoaderManager has finished loading all AsyncTaskLoaders?

The reason I ask is because I want to display a ProgressDialog throbber in the ActionBar while any AsyncTask started by my main Activity is running. My current solution (that semi-works) extends the AsyncTaskLoader. In that class I override the…
1
vote
3 answers

Must an activity or fragment have a separate loader for type of each database operation performed?

Seems the Google-recommended way (using the android support library) for a fragment or activity to interact with a sqlite database is via a loader that extends AsyncTaskLoader and works similar to the way CursorLoader does for ContentProviders. A…
1
vote
1 answer

Json Data reload again on configuration changes in background tasks

I have made an app Earthquake Report app. in that I am fetching earthquake data through an API and showing it in recycler view. This process runs on the background thread by using the Executor service method and runnable. But when I run my app and…
1
vote
1 answer

What do you use for long running tasks since Loaders and AsyncTask have been deprecated?

Loaders and AsyncTask were really easy to use and helpful classes for long running operations like performing network http requests, but since they are deprecated, I couldn't find an alternative. I know that I may use LiveData + ViewModel as Google…
1
vote
0 answers

AsyncTaskLoader: deliverResult, when the variable(for cache) in AsyncTaskLoader will be null(means called)

variable for caching will be initially null and once the AsyncTaskLoader loader execution completed its value will be in that variable. If we want to do the execution again after completion of the first one, how can we clear the cached variable…
Ajay Singh
  • 21
  • 4
1
vote
2 answers

Android: How to add AsyncTaskLoader to this RecyclerView

[Update] Added repository link to download the project I'm having this activity which connects to a URL to fetch data and display it using RecyclerView with a custom adapter. How can I edit this code to use AsyncTaskLoader instead of AsyncTask?…
PHP User
  • 2,350
  • 6
  • 46
  • 87