user4301818 user4301818 - 8 months ago 36
Android Question

Displaying unknown amount of data to screen

I have a sqlite database which contains multiple messages.

Each message has a

  • Title

  • Body

  • Importance level (0/1/2)

  • Possible calander _id

I want to display them to the screen in a scrollable list. Each list item can be clicked on which will then start another activity to edit the message.

I don't want direct code on how to do it, I'd prefer suggestions on how to do it so I can learn myself. If I need to give any extra info please ask.


You need to use adapter in your case CursorAdapter would be appropriate. There are many tutorials on internet about CursorAdapter and using it alongside with SQLite:

A general note about Adapters is that they are a mean to transfer your data to appropriate View so you can populate your ListView, GridView, ... with the customized data. But this need a whole tutorial. You can also look to see how to work with different type of views which allow to be populated with Adapters.