How to do something similar to getView() method in Android but using Cursor
I am quite new to Android.
I have referred the samples provided in Android SDK but they don't provide an example wherein I can use a Cursor
along with getView()
.
I read somewhere that getView()
can't work 开发者_Python百科with Cursor. If this is true, what is the alternative to use a method which works similar to getView()
but using Cursor
.
My actual scenario is:
I am getting a Cursor
which contains data retrieved from the sqlite db. I want to display following inside each listview row:
- An icon in the left of the row
- A text label to the right of this icon
- An icon to the right of this text label
Moreover, I'd have to show/hide the rightmost icon based on certain condition at runtime.
Can somebody point me to the right direction. Possibly some sample code or a link to an online tutorial.
Thanks.
If you are using a ListView with a cursor, you might check out CursorAdapter instead of ListAdapter. http://developer.android.com/reference/android/widget/CursorAdapter.html
精彩评论