0

Is it possible to fetch SQLite on main thread and write from background thread in Android?

I need fetch data prompt, immediately, but long running upsert operation need to execute delayed, when no GUI press goes. DB is common resource in this case. How need it to be locked?

What is if long running background operation is still in progress but needs to fetch meantime?

János
  • 32,867
  • 38
  • 193
  • 353

1 Answers1

0

There is no reference counting, garbage collector manages objects for you, you don't have to worry about that. Just show your prompt, create database and run your operation in background thread. Once it complete and db is no longer needed, gc will remove it (close db manually)

Alex Shutov
  • 3,217
  • 2
  • 13
  • 11