Questions tagged [android-cursorloader]

A loader that queries the `ContentResolver` and returns a `Cursor`. This class implements the `Loader` protocol in a standard way for querying cursors, building on `AsyncTaskLoader` to perform the cursor query on a background thread so that it does not block the application's UI.

A Loader designed to retrieve data from a ContentProvider. This class implements the Loader protocol in a standard way for querying cursors, building on AsyncTaskLoader to perform the cursor query on a background thread so that it does not block the application's UI.

A CursorLoader must be built with the full information for the query to perform, either through the CursorLoader(Context, Uri, String[], String, String[], String) or creating an empty instance with CursorLoader(Context) and filling in the desired paramters with setUri(Uri), setSelection(String), setSelectionArgs(String[]), setSortOrder(String), and setProjection(String[]).

Cursorloader Class Reference

502 questions
107
votes
5 answers

CursorLoader usage without ContentProvider

Android SDK documentation says that startManagingCursor() method is depracated: This method is deprecated. Use the new CursorLoader class with LoaderManager instead; this is also available on older platforms through the Android compatibility…
91
votes
1 answer

Testing ViewPager (and CursorLoader) with Robolectric

Does anyone know how to test the following setup using Robolectric? Fragment containing a ViewPager, data loaded with a CursorLoader. With the code below, the CursorLoader is never pushed into the adapter for the view pager. I get stuck at the…
Corey Scott
  • 2,430
  • 3
  • 28
  • 33
49
votes
3 answers

CursorLoader not updating after data change

I have created a small application, trying to understand the functionality of the LoaderManager and CursorLoader-classes. I have implemented LoaderCallbacks on my FragmentActivity-class and everything works fine, except the fact that when I…
41
votes
1 answer

Access ordered images and video in same Cursor

I'm using the android.content.CursorLoader class to create two Cursor objects to access media stored on the user of my app's device. I'd like to give the user a grid view of their stored images and video which preserves order from the Android…
Cam
  • 1,706
  • 2
  • 13
  • 15
34
votes
2 answers

How to read an SQLite DB in android with a cursorloader?

I'm setting up my app so that people can create groups of their friends. When a group is created, it writes 2 tables to the SQL database. The first table has a group name and a group id. The second table has 2 columns, a group id and a user id. This…
34
votes
1 answer

AutoCompleteTextView backed by CursorLoader

So I am having trouble extending the MultiAutoCompleteTextView and backing it with a CursorLoader, while simultaneously using a custom Tokenizer. The issue rises specifically with the mAdapter.setCursorToStringConverter(); call. The…
31
votes
1 answer

Android 3.0 - what are the advantages of using LoaderManager instances exactly?

With 3.0 we got the fancy LoaderManager, which handles data loading using the AsyncTaskLoader, the CursorLoader, and other custom Loader instances. But reading through the docs for these I just couldn't get the point: how are these better than just…
31
votes
2 answers

Android RecyclerView + CursorLoader + ContentProvider + "Load More"

I have created one Activity in that I am implementing CursorLoader for load data from Database. I have done that thing for all records of that Table but I want to load 30-30 records like Load More Functionality I have tried to create query and its…
29
votes
5 answers

Data out of sync between a custom CursorLoader and a CursorAdapter backing a ListView

Background: I have a custom CursorLoader that works directly with SQLite Database instead of using a ContentProvider. This loader works with a ListFragment backed by a CursorAdapter. So far so good. To simplify things, lets assume there is a Delete…
28
votes
1 answer

What's the mechanism of setNotificationUri?

I've just implemented a CursorLoader and it works great! In fact, I didn't believe that my ListView would automatically update when the underlying data changed until I tested it. This apparently is the magic of setNotificationUri. My question is,…
Bhagwad Jal Park
  • 1,093
  • 1
  • 13
  • 22
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.…
24
votes
1 answer

Android Browsing history leaving out some sites only

Using the function below I am trying to get the LAST url that the user visited from Chrome Browser on their Android Phone. This function works very well for most sites, but does not work for "www.reddit.com". The url variable below updates if I go…
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…
23
votes
2 answers

How to specify the sort order for the query to a content provider

I am trying to load all items from a Sqlite Table in Android and want to order the result. How do I specify the order for the returned cursor? I query the ContentProvider through a CursorLoader the following way: new CursorLoader(context,…
Janusz
  • 187,060
  • 113
  • 301
  • 369
1
2 3
33 34