Questions tagged [android-cursoradapter]

CursorAdapter is an Android Adapter class which exposes data from a Cursor to an AdapterView.

The CursorAdapter introduces special methods related to working with the data Cursor. Also the CursorAdapter introduces a different implementation pattern than the list based adapters, as it recommends implementing the newView and bindView methods to build the row view(instead of just the getView method). Different subclasses of CursorAdapter(like SimpleCursorAdapter, ResourceCursorAdapter etc) are available for easy use so the user isn't required to provide the full implementation that the CursorAdapter needs. More information can be found in the documentation of the class.

Tag Usage:

880 questions
61
votes
3 answers

Cursor adapter and sqlite example

Hello I am looking for sample code in which cursor adapter is used with sqlite?
Gainster
  • 5,481
  • 19
  • 61
  • 90
46
votes
3 answers

cursoradapter with different row layouts

I'm trying to create a custom cursoradapter that will use two different layouts depending on some data in the cursor. I keep reading about 'overriding getViewTypeCount() and getItemViewType()' to make this happen but I can't seem to figure out how…
Jap Mul
  • 17,398
  • 5
  • 55
  • 66
44
votes
1 answer

Best practices to query SQLite database in ListFragment with CursorLoader?

I'm using Android Compatibility Library in my project. I've set up ListFragment as described in the DevGuide (http://developer.android.com/reference/android/app/Fragment.html), and using a simple CursorLoader Christian made be used without content…
micadelli
  • 2,482
  • 6
  • 26
  • 38
34
votes
4 answers

Android Cursor with ORMLite to use in CursorAdapter

Is there any way to get Cursor for a query, which I am processing with ORMLite Dao object?
sealskej
  • 7,281
  • 12
  • 53
  • 64
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…
31
votes
2 answers

Android - Is ViewHolder pattern automatically implemented in CursorAdapter?

I always use ViewHolder pattern in my custom ArrayAdapter classes. However, in CursorAdapter the getView() method is not mandatory required to be overridden , but has the bindView and newView methods. My question is - does CursorAdapter re-uses…
Mahendra Liya
  • 12,912
  • 14
  • 88
  • 114
25
votes
1 answer

What bindView() and newView() do in CursorAdapter

I have a custom CursorAdaptor in my project with overridden methods bindView(View view, Context context, Cursor cursor) and newView(View view, Context context, Cursor cursor). I want to know for what CursorAdapter are used for and what is the…
Jainendra
  • 24,713
  • 30
  • 122
  • 169
22
votes
2 answers

Converting an ArrayAdapter to CursorAdapter for use in a SearchView

How can I convert an ArrayAdapter of static data into a CursorAdapter for using Suggestion Listener in SearchView? I have constructed the ArrayAdapter from static data (allString) ArrayAdapter searchAdapter = new…
21
votes
3 answers

Drag and drop sorting of cursor adapter and list adapter

I'm very surprised there is such a small amount of info on drag and drop sorting with a cursor adapter and list adapter. The closest post I have found on stackoverflow is this one: https://stackoverflow.com/a/5047618/317889 But, it's not clear to me…
HGPB
  • 4,346
  • 8
  • 50
  • 86
19
votes
3 answers

Android - How to get position in bindView like in getView?

In getView() of CursorAdapter, there's a parameter position so I can do a checking for that position, how can I do the same on bindView() it has no position parameter in BindView. Currently I'm overriding newView(), bindView() and getView() which…
lorraine batol
  • 6,001
  • 16
  • 55
  • 114
16
votes
2 answers

Android: how to use CursorAdapter?

I have a database, a ListView, and a CustomCursorAdapter that extends CursorAdapter. A menu button adds an item to the database. I want the ListView to update and show this change. Normally it doesn't show this new item until i go to the homescreen…
user316146
  • 1,307
  • 1
  • 12
  • 19
16
votes
4 answers

ListView using two cursoradapters?

I have some code which executes two queries against a database and returns two cursor objects. Is there any way that I can combine these two cursors so that all the ListView gets the data from both?
Martyn
  • 16,432
  • 24
  • 71
  • 104
15
votes
2 answers

CursorAdapter bindView optimization

When overriding ArrayAdapter I know is correct using a pattern like this: if(view != null){ ...create new view setting fields from data }else return view; //reuse view is correct too using this pattern with CursorAdapters? My problem is that…
user1610075
  • 1,583
  • 3
  • 15
  • 32
13
votes
2 answers

Android: Extending user's contact book. Performance ContentProvider vs Sqlite vs List in memory

Me and my Android team have a problem. We have an app that present the user's contact book, with extended information. Current setup Our app reads the Contacts Provider of the Android OS. Sends this information to our Server that calculates a couple…
13
votes
3 answers

ORMLite with CursorAdapter in Android

I am modifying my Android app to work with ORMLite, and it currently uses a number of CursorAdapters, which I quite want to keep in an attempt to minimise coding. I'm not 100% sure but t appears that when ORMLite creates an id field in the db, it…
Stev_k
  • 2,118
  • 3
  • 22
  • 36
1
2 3
58 59