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
0 answers

Background worker as - AsyncTask or Loader or Fragment without UI or Service

I know there are many threads about this topic, but: I have a simple task. public class MyTask extends AsyncTask { ... @Override protected Void doInBackground(T... params) { for (int i = 0; i < 60; i++) { …
theSpyCry
  • 12,073
  • 28
  • 96
  • 152
1
vote
2 answers

Cannot cancel running AsyncTask in AsyncTaskLoader

I want to cancel running AsyncTask (in AsyncTaskLoader) when the user clicks the home button. Here is what I created so far: package cz.davidliska.android.loaders; import java.text.SimpleDateFormat; import java.util.Date; import…
D-Fox
  • 303
  • 1
  • 6
  • 8
0
votes
1 answer

Fragment with AsyncTaskLoader influence other fragments' attaching to the activity

I've used AsyncTaskLoader to load a cursor from a database query. I followed Android Developers sample: http://developer.android.com/reference/android/content/AsyncTaskLoader.html But somehow the fragments that being added to the page adapter after…
0
votes
2 answers

Populating ListFragment with remote data

I have a ListFragment, currently populated with static data, fixed at compile time. I actually want the data for the list to be screenscraped from the web. I plan to use jsoup to do the retrieval and parsing etc. But what's the best way to link…
Ian Partridge
  • 79
  • 1
  • 6
0
votes
3 answers

Error while using AsyncTaskLoader

This is my FragmentListArraySupport.java package com.test.methods; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.app.ListFragment; import android.util.Log; import android.view.View; import…
Hick
  • 35,524
  • 46
  • 151
  • 243
0
votes
1 answer

Why does my TaskLoader only stores the last data?

I am having problem with the flow of my code. Please please please help :( Okay, so the flow goes like this. the first Activity loads the recyclerviewwhich stores the ArrayListdata. The data of the Arraylist consist of information about a Premise…
0
votes
1 answer

AsyncTaskLoader does not cache data offline

I have created an AsyncTaskLoader for loading JSON data from an API. However, I noticed that if I rotate the screen of my device, it tries to load the data from the API again. As a result, if I turn off my Internet connection and rotate the screen,…
Victor Durojaiye
  • 162
  • 1
  • 10
0
votes
1 answer

Weird AsyncTaskLoader behavior

My app downloads JSON data from Internet and displays it as a RecyclerView list. This is implemented through LoaderManager/Loader means. Action is initiated by clicking a button. In onCreate I call initLoader() if that specific loader already…
Drinkwater
  • 151
  • 6
0
votes
0 answers

Android AsyncTaskLoader: How to use it inside adapter

I'm using AsyncTaskLoader in my project without issues in activities but now I want to trigger it inside the adapter. The list item populated by RecyclerView has multiple elements which do certain actions via API and I need to implement…
PHP User
  • 2,350
  • 6
  • 46
  • 87
0
votes
2 answers

Android JSON parsing output issue

This is the first time in my life working with AsyncTaskLoader. I am struggling to get output on RecyclerView. I have checked with logs and seems parsing JSON correctly but I don't know what is wrong not giving output rather showing No news found…
Code Lover
  • 8,099
  • 20
  • 84
  • 154
0
votes
0 answers

Error on Android Studio: Program type already present: android.support.v4.content.AsyncTaskLoader

when I put multiDexEnabled true, it keeps showing the above error. After I deleted multiDexEnabled true, the above error is gone, but got another error: Program type already present: android.support.v4.app.FragmentTransitionCompat21$2. Pls help.
0
votes
2 answers

Should I use a Loader for each http connection or a single Loader for all it enough?

I am newbie of Android, trying to make a simple news feed app. I am using Asynctaskloader for background operations. For now, I am using a single Loader to connect different news sources. My question is should I define and run different loaders for…
Huseyin Sahin
  • 211
  • 4
  • 16
0
votes
0 answers

Android onCreateLoader incompatible types

I recently tried to use a Loader to do background task in my app, but I've stumbled upon a problem as I implemented it. There is a conversion problem in the override of the onCreateLoader method (here is the code): @Override public…
tom gautot
  • 378
  • 2
  • 10
0
votes
1 answer

AsyncTaskLoader keeps reloading data when I come back to the MainActivity

I am quite new to the Android Development and I really need your help. My problem is in the MainActivity below. The app essentially displays a list of movies in the main activity and the movie details in another activity. And the problem is that…
Matthew
  • 3
  • 3
0
votes
0 answers

Implementing two AsyncTaskLoaders in the same activity

I am a newbie, trying to execute 2 url queries on the same activity in Android. I managed to get it done using two different AsyncTasks running in parallel. Both url queries have separate classes and query classes - its two different websites with…