Re: [android-developers] Re: Data written to SQLite database not immediately available

2011-12-23 Thread Ralph Bergmann | the4thFloor.eu
Am 23.12.11 00:06, schrieb lbendlin:
 it's not a bug, that's how SQLite works. You can't have concurrent
 writes. Not sure how the content provider buffers this but if you do
 plain SQLite you are basically blocking the database with each write,
 and you need to use semaphores to manage that.

I think a content provider can handle that.

I think you only have a timing problem. The content provider needs a
little bit to store the data.

You send a ping from one thread to the other thread. A better solution
is to register a content observer. With this observer the other thread
gets automatically a notification if the content provider has saved the
data.


Ralph


-- 
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


Re: [android-developers] Re: Data written to SQLite database not immediately available

2011-12-23 Thread Kostya Vasilyev

To OP:

Do your threads use separate instances of SQLiteDatabase object pointing 
to the same database one- or one SQLiteDatabase instance, shared?


23.12.2011 18:03, Ralph Bergmann | the4thFloor.eu пишет:

Am 23.12.11 00:06, schrieb lbendlin:

it's not a bug, that's how SQLite works. You can't have concurrent
writes. Not sure how the content provider buffers this but if you do
plain SQLite you are basically blocking the database with each write,
and you need to use semaphores to manage that.

I think a content provider can handle that.

I think you only have a timing problem. The content provider needs a
little bit to store the data.

You send a ping from one thread to the other thread. A better solution
is to register a content observer. With this observer the other thread
gets automatically a notification if the content provider has saved the
data.


Ralph




--
Kostya Vasilyev

--
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


Re: [android-developers] Re: Data written to SQLite database not immediately available

2011-12-23 Thread Erik
The threads use the content provider. The content provider's insert() 
method gets a database from the SQLiteOpenHelper each time.

I'll add that the content provider we're using is a modified version of 
Google's telephony content provider. We've been able to duplicate this 
behavior with the actual telephony provider on a shipping phone.

-Erik

On Friday, December 23, 2011 7:50:45 AM UTC-8, Kostya Vasilyev wrote:

 To OP:

 Do your threads use separate instances of SQLiteDatabase object pointing 
 to the same database one- or one SQLiteDatabase instance, shared?



-- 
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