Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - should all database operations be done in a thread? [duplicate]

Possible Duplicate:
When should I do certain SQLite operations on another thread(not the main thread)?

I am wondering, should all SQLite database operations in my android app be done in a thread, or can small ones, such as adding a single row, be used on the UI thread?

like image 795
Todd Davies Avatar asked Dec 10 '25 18:12

Todd Davies


1 Answers

Its purely a matter of choice .

While some stubbornly say that all DB operation must be in thread while others might not feel the same.

So it depends on the developer and how he wants the UI to be.

In my opinion creating thread for a simple write operation is actually an overhead and would be more convenient to be on UI thread.

But beware of such usage an exception can cause your UI thread to be exceptioned.

like image 177
Gaurav Shah Avatar answered Dec 13 '25 06:12

Gaurav Shah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!