Questions tagged [android-loadermanager]

An abstract class associated with an Activity or Fragment for managing one or more Loader instances. This helps an application manage longer-running operations in conjunction with the Activity or Fragment lifecycle; the most common use of this is with a CursorLoader, however applications are free to write their own loaders for loading other types of data.

Interface associated with an Activity or Fragment for managing one or more Loader instances associated with it. This helps an application manage longer-running operations in conjunction with the Activity or Fragment lifecycle; the most common use of this is with a CursorLoader, however applications are free to write their own loaders for loading other types of data.

While the LoaderManager API was introduced in HONEYCOMB, a version of the API at is also available for use on older platforms through FragmentActivity.

There is only one LoaderManager per activity or fragment. But a LoaderManager can have multiple loaders.

Useful links

397 questions
27
votes
1 answer

How can I refresh the cursor from a CursorLoader?

So I have my MainDisplayActivity which implements both Activity and LoaderManager.LoaderCallbacks. Here I have A ListView, which I fill with Agenda information that I get from my database using a ContentProvider. I also have a GridView which…
25
votes
2 answers

What are the benefits of CursorLoaders?

I use Cursors extensively in my app, to load and occasionally write information from and to a database. I have seen that Honeycomb and the Compatibility Package have new Loader classes designed to help with loading data in a "good" way.…
Alex Curran
  • 8,668
  • 5
  • 46
  • 55
24
votes
3 answers

How do CursorLoader automatically updates the view even if the app is inactive?

I have been working on a small To-Do list app. I used CursorLoader to update the ToDolistview from a content provider. I have a written a function onNewItemAdded(), which is called when user enters a new item in the text view and clicks enter. Refer…
24
votes
4 answers

AsyncTaskLoader onLoadFinished with a pending task and config change

I'm trying to use an AsyncTaskLoader to load data in the background to populate a detail view in response to a list item being chosen. I've gotten it mostly working but I'm still having one issue. If I choose a second item in the list and then…
23
votes
6 answers

What is the appropriate replacement of deprecated getSupportLoaderManager()?

I came to know that getSupportLoaderManager is deprecated. But I want to call: getSupportLoaderManager().initLoader(0, null, mRecipeLoaderManager); What should be an alternative to that call? Or can I still use getSupportLoaderManager without…
fabi
  • 404
  • 1
  • 4
  • 11
22
votes
4 answers

android compatibility package - fragment ... not attached to Activity

Hello, I'm facing this problem : I'm using Compatibility package to use fragment in android application (min SDK 2.1). An random exception occurs on fragment sometimes and I can't figure out why. This is the stack trace I…
Seynorth
  • 622
  • 2
  • 7
  • 20
22
votes
1 answer

How does CursorLoader with LoaderManager know to send the cursor to a CursorAdapter?

I was going through some of my code and I realized I don't actually know how a CursorLoader and LoaderManager combination used with a CursorAdapter connect. Heres the part that I am confused in. agendaAdapter = new MyAgendaAdapter(this,…
21
votes
5 answers

OnLoadFinished() called twice

I'm trying to figure out if I'm doing something wrong with respect to Loaders. I'm using the support library, and I have a Fragment which in onCreate() calls initLoader() setting itself as the LoaderCallbacks, however on a rotation it is receiving…
19
votes
5 answers

Refreshing a view inside a fragment

I have searched the numerous questions that look like this one, but haven't found my answer in any of them. I have an activity that has 3 tabs accessible through the action bar. I achieved this by adding 3 fragments that inflate a custom view I made…
J. Maes
  • 6,612
  • 5
  • 25
  • 33
18
votes
6 answers

Android error: java.lang.IllegalStateException: trying to requery an already closed cursor

environment (Linux/Eclipse Dev for Xoom Tablet running HoneyComb 3.0.1) In my app I'm using the camera (startIntentForResult()) to take a picture. After the picture is taken I get the onActivityResult() callback and am able to load a Bitmap using a…
cyber-monk
  • 5,260
  • 6
  • 29
  • 41
17
votes
1 answer

What's the purpose of startManagingCursor?

Ok, the documentation states that it lets the Activity manage the cursor's lifecycle. But I don't really see the point of it since when the activity is destroyed, any references to the newly created cursor should be also erased and then the cursor…
Bilthon
  • 2,435
  • 8
  • 33
  • 44
16
votes
1 answer

What is the scope of LoaderManager?

When creating an Android application using Loaders, should every activity and fragment have its own LoaderManager? Or should there only be one LoaderManager that the application owns? And lastly, are the "unique IDs" that are used to identify…
Alex Lockwood
  • 81,274
  • 37
  • 197
  • 245
16
votes
2 answers

What is the scope of a LoaderManager?

When identifying Loaders in your LoaderManager, you use unique ids. I'm asking about how unique those ids have to be. Does every activity and fragment have its own LoaderManager? Do fragments use the LoaderManager of the Activity they're attached…
16
votes
5 answers

Loader doesn't start after calling initLoader()?

I have a fragment, and want to start a loader when a button is clicked: public class MyFragment extends Fragment { public void onActivityCreated() { super.onActivityCreated(); Button btn = ...; …
16
votes
4 answers

Global Loader (LoaderManager) for reuse in multiple Activities / Fragments

What I would like to achieve: I have two different fragments. I would like them both to show the same data in two forms (in a list and on a map). I would like them to share one Loader (AsyncTaskLoader in particular). Everything works fine, but the…
1
2
3
26 27