-2

I have an android app that constantly inputs data on a database (sqlite). every 3 or 6 seconds (sometime is less than that) I insert data into the DB. I created a DatabaseHelper (SQLiteOpenHelper) object which does that but I've been wondering if its better to close and create a new DatabaseHelper object each time I input data or if its better to keep it open?

1 Answers1

1

It's better to use a single connection throughout your whole app, it's explanied here. Also you could use ORM Lite.

But keep in mind that you should use ROOM, from Android documentation:

We highly recommended using the Room Persistence Library as an abstraction layer for accessing information in your app's SQLite databases.

javdromero
  • 1,850
  • 2
  • 11
  • 19