I've got a a credit card applicatoin which has 2 parts.
- Something which produces content.
- A credit card applicatoin that utilizes this content
All these run as different processes. However , each of them share a database. And That I are often database locked error, both once the service attempts to write something and also the UI is reading through data. Also the other way around. How can build a storage shed?
- The course accustomed to access DB is really a singleton class. Consider both UI &lifier the service are 2 different processes, you will find 2 singletons I presume. To ensure that does not help.
synchronisewill not help I guess, since again due to 2 different processes.
Content Providersmaybe a choice, consider I personally use complex queries to search info, it might be very hard to make use of this too.
How do you obtain the two processes share the database. Any cues could be greatly appreciated.
You need to use a content provider to funnel your database queries through one source. Within the content provider you should use any securing systems you want to ensure you are not getting concurrent access. You may even consider using content experts to coordinate service actions with changes towards the database.
This is an excellent article how securing works together with SQLite on Android and what things to understand: http://kagii.squarespace.com/journal/2010/9/10/android-sqlite-locking.html
I'd think you will find some solutions there :)
close the bond after each operation
catch the database locked error and then try to reunite after 50ms
or allow the service handle the database and also the activity request the service for data
might be there's isDatabaseInUseMethod ?