SimpleCursorAdapter and CursorAdapter
Asked Answered
R

2

6

I want to know what are the differences between CursorAdapter and SimpleCursorAdapter. Based on what criteria someone would choose the one or the other. Your experiences working with them? Thank you

Rew answered 5/12, 2011 at 8:27 Comment(1)
CursorAdapter is abstract. Working with it is completely up to how you choose to implement it.Jahncke
F
9

I think that the main question is still not answered. SimpleCursorAdapter exists for those who want to save some time making their own CursorAdapter. SimpleCursorAdapter is already made from google and you just tell him how should the layout look like and what ids of widgets you want to fill with your chunks of data, so you dont have to override methods of CursorAdapter and implement them. But you can use only TextView and ImageView in your layout, because it doesn't support more widgets so far.

So as result SimpleCursorAdapter takes like 2 lines of code but extending CursorAdapter means lots more but you have more options for customization. I believe SimpleCursorAdapter should be enough in most cases.

Fenella answered 20/5, 2014 at 10:15 Comment(0)
U
8

CursorAdapter is abstract and is to be extended. On the other hand, SimpleCursorAdapter is not abstract.

Notice that newView(Context context, Cursor cursor, ViewGroup parent) is abstract in CursorAdapter but implemented in SimpleCursorAdapter. This is because SimpleCursorAdapter has a specific mechanism to initiate views while CursorAdapter leaves it up to the developer.

Use answered 5/12, 2011 at 8:40 Comment(1)
ok thanks, but which one you would choose to fill a ListView?Rew

© 2022 - 2024 — McMap. All rights reserved.