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

How to turn this asyncTask to AsyncTaskLoader?

How to turn this code of AsyncTask to AsyncTaskLoader since movieListFetcher.listType is an enum? class LoadMovieList extends AsyncTask { @Override protected Void…
1
vote
0 answers

Horizontal recyclerView inside item in vertical recyclerView

I have an issue in my app ... i am using ramotion.foldingcell library and using it to make list by recyclerView and when tap in cell of list it open another recyclerView but in horizontal ... i get data from json and usin AsynctaskLoader to load…
elblasy
  • 69
  • 2
  • 7
1
vote
0 answers

AsyncTaskLoader and orientation change

There is very simple code. MainActivity.java: public class MainActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks { @Override protected void onCreate(Bundle savedInstanceState) { …
Hagakurje
  • 1,002
  • 2
  • 11
  • 17
1
vote
2 answers

onLoadFinished called with wrong data even if loadInBackground returns correct data

I am making an app to display the movies list as shown in the screenshot. The problem is that when I select the options menu top_rated option it reloads the correct data but the list returned to onLoadFinished contains the previous data with the new…
Trishant Sharma
  • 125
  • 2
  • 10
1
vote
0 answers

Can we ever use AsyncTask and AsyncTaskLoader in the same project?

I am new to android developing. And i have searched for this answer. Here’s what i know: Both AsyncTask and AsyncTaskLoaders do background processing in Android. The AsyncTaskLoader framework uses AsyncTask. In most cases, it’s better to perform…
1
vote
0 answers

Parsing json with AsyncTaskLoader

I'm trying to use AsyncTaskLoader to retrieve data then parse the resulting json file, however, I can't figure out why I keep getting a return null; instead of returning return gameList; DailyScheduleFragment.java Method calling the Loader: …
Ziggy
  • 23
  • 5
1
vote
1 answer

how to use gridview in onPostexecute AsyncTask

i have following code , i want image load first from drawable folder and after api. image successfully load from drawable folder using getData() method, but i don't know how to load image from url and update gridview. onPostExecute method when i…
Sami
  • 117
  • 1
  • 12
1
vote
2 answers

How to replace AsyncTask and AsyncTaskLoader with their Rx equivalents?

Background Some articles claim that Rx can replace AsyncTask and AsyncTaskLoader. Seeing that Rx usually makes code shorter, I tried to dive into various samples and ideas of how it works. The problem All of the samples and articles I've found,…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
1
vote
1 answer

Does `LoaderManager.restartLoader` create a new object?

Does the restartLoader(int id, Bundle args, LoaderCallbacks callback) create an entirely new loader object? Or does it just reuse the old one by resetting its internal state? Thanks for any help.
user8743642
1
vote
1 answer

Xamarin android AsyncTaskLoad class

I'm going through Big Nerd Ranch's Android Programming book and i'm currently on the chapter that teaches loaders. Also i'm not using android studio and Java, but rather Xamarin/mono for building the apps. In the book it wants me to create a class…
Benji
  • 489
  • 2
  • 4
  • 14
1
vote
1 answer

Method in onCreate runs only after device rotation

My Activity uses RecyclerView to show a list of data. This data downloads some Moviews using a AsyncTaskLoader. I initialise the loader in onCreate but when I run it I see nothing. But if I click the button to rotate the device I see data. I tried…
VolodymyrH
  • 1,927
  • 2
  • 18
  • 47
1
vote
2 answers

How to delay method call until another method been done first

I'm using loader to fetch data from the internet and GoogleApiClient to get the user location i pass a string url with location to the loader constructor ,onCreateLoader method called before onLocationChanged method that get the user location as an…
MuhammadAliJr
  • 273
  • 4
  • 17
1
vote
1 answer

Display data from JSON in recyclerview using AsyncTaskLoader

please I am trying to post data from JSON in my recyclerview. I am using the AsyncTaskLoader but nothing just shows on the screen. I have logged the data I need from JSON, to confirm I got the parsing right, and they show up. I have also logged the…
Ire
  • 15
  • 8
1
vote
0 answers

onLoadFinished() behavior on screen orientation change

I have the following Loader implemented, which is a subclass of AsyncTaskLoader. The LoaderManager initLoaderManager() is called in the Activity's onCreate() method. When I rotate my screen, I see that the onLoadFinished() is getting called…
Sumit Trehan
  • 3,985
  • 3
  • 27
  • 42
1
vote
2 answers

Android Best Practices for Local Files

I'm currently writing an application which displays items within a ListView which then users can either add to or delete from. I am making this data persistent by writing out to a local JSON file (I'm saving the data as a JSONArray and then calling…