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
1
vote
1 answer

Android. Fetch data from database and then make network query. How to implement?

I'm pretty new to an Android development and currently trying to write an app that will show tomorrow's weather of multiple cities. Sorry for any incorrent termins that I might use in this question. What I want to reach: App will fetch data from…
1
vote
1 answer

What is best approach of Replacement of AsyncTaskLoader by RxJava2?

I am super junior in RxJava and I may need to find a better approach if there is a better way to do it. I am working on a legacy Loader code and I want to replace it by RxJava. I have following in my original code: public class…
Hesam
  • 52,260
  • 74
  • 224
  • 365
1
vote
1 answer

onLoadFinished is not always being called when loader restarted

After I let my user download files to cloud, I want my app to restart its loader. Previously, onLoadFinished is not always being called (randomly), when I wrote my code in the following way public void reloadAfterOpenFromCloud() { LoaderManager…
Cheok Yan Cheng
  • 47,586
  • 132
  • 466
  • 875
1
vote
1 answer

AsyncTaskLoader in fragment

I have a simple fragment, trying to implement AsyncTaskLoader in it. But i am getting one compile time error : error: incompatible types required: Loader< List< String>> found: LoaderDrone the error is in the onCreateLoader method. what am i…
1
vote
0 answers

RxJava replacement for AsyncTaskLoader+ContentProvider

Does anyone know if it is possible to use RxJava to monitor a SQLite database table for changes and update the UI (a ListView) on detecting any updates. i.e. basically a replacement for the functionality of AsyncTaskLoader and a ContentProvider? A…
1
vote
0 answers

UDP Scanner protocol with AsyncTaskLoader in Android

I'm working on my first Android app. The application shall scan for devices on the network using a proprietary protocol based on UDP broadcast. The protocol can send a discover message and receive responses from all available devices. Later on it…
Jonas
  • 11
  • 1
1
vote
1 answer

How can I tie an AsyncTaskLoader to a Fragment's lifecycle?

I am using the support library and am using an AsyncTaskLoader. Why doesn't the constructor of the AsycTaskLoader not accepting a Fragment as a parameter? I only want the AsyncTaskLoader to start loading data when it is called or initialized inside…
1
vote
1 answer

AsyncTaskLoader endless onCanceled call

I am creating an AsyncTaskLoader based on http://developer.android.com/reference/android/content/AsyncTaskLoader.html. When I run my app, according to my logging, the app endlessly oscillates between loadInBackground and onCanceled. Does anyone know…
learner
  • 11,490
  • 26
  • 97
  • 169
1
vote
3 answers

How to give RecyclerView Adapter new data from AsyncTaskLoader

My AsyncTaskLoader is loading data from a remote server. When new data arrives, naturally a call is made to onLoadFinished. At this point I don't know how to give the new data to the RecyclerView.Adapter. Calling notifyDataSetChanged does not give…
learner
  • 11,490
  • 26
  • 97
  • 169
1
vote
1 answer

Android: Asynctaskloader is it necessary to override all onStartLoading, onReset etc function?

I have a problem understand Asynctaskloader... I seen examples override only the loadInBackground method and return the result. Also have seen examples which override onStartLoading, onReset etc .. If i only override loadInBackground, will there be…
LittleFunny
  • 8,155
  • 15
  • 87
  • 198
1
vote
0 answers

better approach for using viewpager with fragments having listviews being populated from webservice call?

First I explain the structure of my app. To be precise MainActivity of my app contains Viewpager with two fragments. Each fragment contains a listview. The data inside listview is being populated from web service call. This web service call is…
1
vote
0 answers

The correct way to get data from database and in the meantime update from server

I wonder what is the correct pattern in android to show user data from database and in the meantime download data from server. Because users hate waiting for content in application i have to prioritize Database Fetcher, but i suppose there may be…
Shu
  • 11
  • 2
1
vote
0 answers

Update child data in listview.setOnGroupClickListener after AsyncTask is finished

I am new to android and currently i'm confronted with a problem i can't solve. I have an ExpandableListView with a custom adapter which extends the BaseExpandableListAdapter. Only the group data is loaded when the ExpandableListView is initiated.…
1
vote
1 answer

Android Loaders: When and why would the data content in the data-source change?

I have read that Loaders monitor the underlying data-source for changes, and load new data whenever it becomes available. My question is that when would the data in the data source change? Any examples will be appreciated. Forexample let's say an…
Solace
  • 8,612
  • 22
  • 95
  • 183
1
vote
0 answers

Using loaders to display data from SQLlite in listview in fragments

My app implementation is an activity which uses Viewpager and different fragments to show on screen depending on tab selection or user swiping the screen. I have attached the screenshot example. Now I want to load data on these fragments from my…