Okay, sure, if you are letting the user open and close databases then you could have an arbitrary number open (if you are actually letting the user do that). But then... you also already have the answer for when to close the database.
For the vast, vast majority of Android applications, there will just be a couple databases the app is dealing with, which a reasonable implementation would just leave open. On Thu, Apr 7, 2011 at 3:33 PM, Nathan <critter...@crittermap.com> wrote: > On Apr 7, 3:15 pm, Dianne Hackborn <hack...@android.com> wrote: > > > > You are making this too complicated. > No, I am not. > > > > > class StuffDatabase { > > SQLiteDatabase mDatabase; > > static StuffDatabase getInstance(); > > > > } > > > > class OtherStuffDatabase { > > SQLiteDatabase mDatabase; > > static OtherStuffDatabase getInstance(); > > > > } > > That works if the number and filenames of databases are statically > determined. > > > > Why in the world do you have 10s of databases? > > > > Why in the world would this be so unexpected? > > Does Excel only allow you to have three spreadsheets and pick all the > names for you? > No. > To use a Google app example, does MyTracks only allow you to record > one track? > No - I've seen the code. It creates multiple Sqlite databases without > having a class for each one. > Would a shopping list application only allow you to have one shopping > list, called default? > A lame one would, yes. > > I really don't think my scenario is that outrageous. > > Nathan > > -- > 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 > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- 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