What are the best practices for SQLite on Android?

前端 未结 10 2274
自闭症患者
自闭症患者 2020-11-21 23:45

What would be considered the best practices when executing queries on an SQLite database within an Android app?

Is it safe to run inserts, deletes and select queries

10条回答
  •  生来不讨喜
    2020-11-22 00:24

    The Database is very flexible with multi-threading. My apps hit their DBs from many different threads simultaneously and it does just fine. In some cases I have multiple processes hitting the DB simultaneously and that works fine too.

    Your async tasks - use the same connection when you can, but if you have to, its OK to access the DB from different tasks.

提交回复
热议问题