Kalina Kalina - 7 months ago 26
Android Question

How to read from a database on Android?

I'm new to databases and have been going through various tutorials, but they all teach me how to create databases, and insert and remove from them. I already have a data.db file that I will not need to change, only read from it. The first column is a date and time, and the rest are information regarding what happened then. The user inputs a start time and end time that they are interested in, or selects all, and that data is displayed graphically.
How do I do this database aspect of it? What methods do I need to look into?

Answer Source

This is a very good basic tutorial that might help you - http://www.vogella.de/articles/AndroidSQLite/article.html#todo_database

You should inspect fetchAllTodos() and fetchTodo(long rowId) functions and try fetching your records. You could look further to see how to add constraints to your sqlite query (something like WHERE startTime > userStartTime AND endTime < userEndTime)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download