user1213167
user1213167

Reputation:

Android - Cursor Loader

I've been trying to use cursor loader.I started following this tutorial http://responsiveandroid.com/2012/03/19/using-an-android-cursor-loader-with-a-content-provider.html but could not understand.tutorial put me in chaos.

As far i know cursorloader is an adapter,adapter job is go to content provider take data then put the data in to view.

What does content resolver do ?

Android document says SimpleCursorAdapter is depreciated and says to use cursor adapter,this is the tutorial that i was talking http://responsiveandroid.com/2012/03/19/using-an-android-cursor-loader-with-a-content-provider.html

Here he uses both simplecursoradapter and cursor loader.Why is that ? Can any one explain me ,how to use cursor loader ?

Upvotes: 0

Views: 1279

Answers (2)

Hang Guan
Hang Guan

Reputation: 102

I think you can still use SimpleCursorAdapter. Looking at the documentation, it looks like the old constructor is deprecated but you can use another constructor which is this one:

SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) Standard constructor.

More details here: http://developer.android.com/reference/android/widget/SimpleCursorAdapter.html

Upvotes: 0

Barak
Barak

Reputation: 16393

You are conflating two different things.

A cursorloader gets that data from your data source and loads it into a cursor then manages the cursor. A cursor is basically an in memory data storage construct.

An adapter takes the data from the cursor (or array or list) and puts into your display layout to be viewed.

Upvotes: 2

Related Questions