The way I do it is by creating an Application subclass with helper methods to access the db. That way access only happens at one spot and both activities and services should be able to access it just fine.
Another thing I do (which works in my case because db access doesn't happen all that often) is open the database before every transaction and close it at the end. On Thu, Feb 24, 2011 at 10:43 AM, Greg Donald <[email protected]> wrote: > Is it possible for an activity and a service to both have simultaneous > access to the same sqlite db? So far I can't seem to find a way due > to the "failed to close()" exception I get when I make the second > connection. I've tried a couple different setups so far, and it seems > my only option may be to have my db stuff live inside the service so I > never need the second connection. Is my thinking correct or am I > missing something? > > Thanks, > > -- > Greg Donald > destiney.com | gregdonald.com > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

