开发者

populating listview of image and text from a cursor query

Good day, this might be a silly question, am having a bit of dilemma as to how to create a listview with an imageview and two textview. I am using a cursor to query the MediaStore, but i don't know which adapter to use. I would have thought using Cursor Adapter, but keep seeing numerous e开发者_如何学运维xamples of using an ArrayAdapter. so am asking, which adapter will best be used to create the listview? is there anything wrong in using CursorAdapter for this my problem or is CursorAdapter only used when you are getting data from a Sql database. Thank you.


Either should work for you, however the CursorAdapter is ... mainly for working with Cursors. As you Query the MediaStore you will notice that you are working with a Cursor, so this would be the best route.

ArrayAdapter will also work, but this is mainly when you are working with Lists or Arrays of items (List of MyObject or MyObject[]).

This question has an example of using a CursorAdapter with MediaStore. Here is a good read on Content Providers (which you might have already read).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜