开发者

How to do something similar to getView() method in Android but using Cursor

开发者 https://www.devze.com 2023-03-08 00:34 出处:网络
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 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

0

精彩评论

暂无评论...
验证码 换一张
取 消