A  content provider won't provide any function over what you have now
-- it's just a different way to accomplish the same synchronization.
With SQLite you basically can't have two transactions going on at the
same time, so you must either use semaphores or some such to prevent
"collisions" or use a server (content provider) so that all the
accesses are through a single thread.

If you understand threads and thread synchronization/exclusion then
your way is probably more efficient and just as reliable.  If you
don't understand threads then the content provider technique is safer.

On Apr 1, 7:51 am, Evgeny Nacu <evgeny.n...@gmail.com> wrote:
> Thanks to everyone!
>   I've heard that ContentProviders do not have such problem. May be
> I'll try to use them, but I have many things to change.
> Thanks for the suggestion.
>
> Evgeny
>
> On 1 апр, 05:11, gjs <garyjamessi...@gmail.com> wrote:
>
> > Hi,
>
> > I (strongly?) suggest you wrap access to the sqlite3 database in a
> > Content Provider if you are accessing concurrently (doing both
> > read&write) from Activity & Service - particularly if Service is in
> > different process.
>
> > Content Provider seems to manage concurrent access for you ok, without
> > having to get involved with semaphores/synchronization yourself.
>
> > Regards
>
> > On Apr 1, 9:21 am, lbendlin <l...@bendlin.us> wrote:
>
> > > yes, semaphores are the way to go, especially for bulk write operations. 
> > > it
> > > helps if you read some of the data from the database into a buffer. Then 
> > > you
> > > can use the buffered data while the database update is processed, and the
> > > users may not even notice.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to