A
A
androidJunior2017-01-29 13:53:13
Android
androidJunior, 2017-01-29 13:53:13

How to connect your database to an Android application?

Hello.
There is a lot of information on how to create your own database in the code itself, but there is no working information on connecting an existing database.
First I want to learn how to work with a clean database, and then start working with ORMLite&
Thank you

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Gamega, 2017-01-29
@gadfi

write the same SQLiteOpenHelper but instead of creating a database, check if there is already a database file;
if not, then copy the finished database from assets (or from somewhere else, for example from the network) to /data/data/YOUR_PACKAGE/databases/DATABASE_NAME
update:

File datbasefile=context.getDatabasePath(DATABASE_NAME);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question