Naruto
Naruto

Reputation: 9634

Access data from sqlite database

i have data stored in sqlite database, now it has to be fetched and display it on UI. To do this i have a cursoradapter.

is this the efficient way to display data?, do we need to use content providers & loaders for this purpose? what are there advantages & disadvantages ?

Upvotes: 0

Views: 38

Answers (1)

nunoh123
nunoh123

Reputation: 1227

I usually dont use cursorAdapter instead i create a class "datasource" that handles all databases interactions: create update delete and read where read returns either a single or list of objects containing the data from the database. From there i use a custom adapter to show the data on a list or a gridview.

This tutorial shows how to make that database interaction class http://www.vogella.com/tutorials/AndroidSQLite/article.html

and this one show how to create a custom adapter for a listview http://www.vogella.com/tutorials/AndroidListView/article.html

Upvotes: 1

Related Questions