So I have a database named db.sqlite3. And I work on an Android project. I need to do some query on it.
I have a lot of questions about it – is there a good tutorial?
Most importantly, where did I put the database? (It’s not to big in the project but which folder?)
How do I do a query?
(When I googed it, I didn’t find anything relevant.)
Put the database in the assets folder. At runtime you can access it like this:
You can write it wherever you want, but it is better to store it in the
/data/data/%app_package_name%/databasesfolder.Then extend SQLiteOpenHelper and pass “db.sqlite3” as the name argument:
Later, you can
getReadableDatabase()orgetWritableDatabase()and issue queries on the returned objects.