Good day to all! I had such a question, the answer to which, unfortunately, I did not find ... All Android developers strongly recommend to perform absolutely ALL database operations in a separate thread (use AsyncTask or AsyncTaskLoader ). With the operation of obtaining data, everything is clear here, it is really possible to load the system with a huge number of lines, so here the use of loaders is quite reasonable. But I am writing a simple application (ordinary checklist), in which there are two simple tasks:
When installing the checkbox of the corresponding task, set the IsDone = true | false value for the string to the database (that is, a simple query like UPDATE Tasks SET IsDone = true WHERE TaskId = 10 )
Add a task to the database from a separate activation and close it. (Naturally, user interaction with the activation is not needed here, as long as the line "is added").
So, the question is as follows. Is it necessary for each such simple database queries to sculpt their own AsyncsTasks separately, suffer from the synchronization of streams, and thereby turn their code into "vermicelli" from AsyncTasks ? I would like to know the opinion of experienced developers. Do you always put queries to the database in separate threads, or do you leave such simple queries (which I cited as an example) in a UI thread?