SimpleCursorAdapter vs CursorAdapter?
Asked Answered
D

1

7

I have some cursor with data. I have TextView which visibility depends on some property of the item of cursor. I use SimpleCursorAdapter and override getView method. But I am actually not use from and to properties of SimpleCursorAdapter.

Is it better to change my adapter to CursorAdapter and override newView and bindView methods?

Denominative answered 29/9, 2012 at 10:46 Comment(1)
Possible duplicate of SimpleCursorAdapter and CursorAdapterProtoxide
T
7

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.

Source : SimpleCursorAdapter and CursorAdapter

Added:

I have TextView which visibility depends on some property of the item of cursor.

For this you can check SimpleCursorAdapter.ViewBinder interface.

Thorner answered 29/9, 2012 at 12:12 Comment(3)
and what will you advise to use?Denominative
I think using SimpleCursorAdapter you can achieve what you want. So it's better to go with SimpleCursorAdapter. Using CursorAdapter you may have to do little more work. Also I have updated my answer plz check.Thorner
yes I have tried with viewBinder too, but not be sured which method is best, I desided to extend adapterDenominative

© 2022 - 2024 — McMap. All rights reserved.