I have a custom content provider and I need to insert one record at a time when user clicks on some button, and it is not too often. I was wondering that should I do this insert in background thread (AsynchTask, etc) or should I just insert it on GUI thread? Right after insertion I have to update GUI.
If I should do it in background thread then what is the best approach… I guess asynctask is the best choice.
Thanks in advance 🙂
I have a custom content provider and I need to insert one record at
Share
I advise against accessing your provider on the main thread. Use CursorLoader for queries. Use ContentProviderOperation objects and ContentResolver.applyBatch() for modifications. These classes handle all of the background work for you.
ASyncTask is a much more general-purpose class.