Fwiw, a database is way overkill for a debug log or other such thing. Databases aren't free -- all of their features come with significant costs. If you actually are using those features (queries etc) then they are useful. But for a debug log? You are bringing in a ton of overhead for no real gain.
As far as databases vs. content providers, I definitely lean towards the camp of avoiding content provider if the data you are managing is never going to be made available to other apps. That said, content providers are such a common pattern in Android's standard apps (since they tend to publish their data to others) that most of the helpers for dealing with structured data are oriented around them. Also keep in mind that "publish to others" can actually be pretty broad -- for example if you are writing a messaging app, you probably have no reason to want to expose that data as a content provider to others. Except... well, if you are going to do a "share" option you will need to have a content provider for a URI to share with others. And in Android 3.0 the drag and drop and rich clipboard APIs are built around data stored in a content provider. Even there, though, there's no reason you couldn't take a hybrid approach -- have your application directly access the database, and put a content provider on top of the same database just for publishing specific URIs you want to make available to other apps. On Sun, Feb 27, 2011 at 1:51 PM, Jake Colman <[email protected]> wrote: > > Kostya, > > Unless I misread it, ACRA is good for catching thrown exceptions and > automatically sending them to the developer. I am looking for something > will allow me to create a trace file. Essentially, I'm looking for a > good way to trap the kind of output that I might otherwise send to > syslog (via Log.d) but do it such that I can collect the trace and have > the app email it upon request. Can ACRA do this? > > I also looked at microlog4android but the documentation is not easy to > follow and it looks like alot of work. > > A helpful soul in this group provide me some starter classes that will > log a trace into a database. I can then access the database when I want > and extract what I am looking for. > > Can you suggest some other alternative? > > Getting back to the original topic, so a Content Provider is a good > paradigm to use across the board even if the database is only meant to > be used internally? > > ...Jake > > > >>>>> "KV" == Kostya Vasilyev <[email protected]> writes: > > KV> Jake, > > KV> ContentProvider isn't just for exporting data. > > KV> One useful thing it provides is data change notifications (based > KV> on data URIs). In practice, it means that ListViews with content > KV> provider-supplied data refresh automatically, and it's really > KV> easy to make other UI elements also update automatically by > KV> registering data change observers. > > KV> Another useful thing is that it forces you to map your data into > KV> a hierarchical URI-based scheme. This, IMO, results in a cleaner > KV> conceptual model for your data. > > KV> Yet another is that you can easily pass data references between > KV> activities by using a data URI. > > KV> On the other hand, with content providers you can't just run a > KV> raw sql statement whenever you feel like it - all data access is > KV> structured, so you've got to do some planning first. > > KV> Howerver, for debug info, I probably wouldn't bother with a > KV> content provider or a database at all. Just a text log file, with > KV> timestamps, so it can be cross-referenced with the logcat (if you > KV> can collect that too). > > KV> And speaking of debug reports - have you looked at ready-made > KV> solutions for this? For example, this one is often recommended on > KV> this list: > > KV> http://code.google.com/p/acra/ > > KV> -- Kostya > > KV> 28.02.2011 0:18, Jake Colman пишет: > >> What are best practices? My app will use a private database to store > >> debug information. Should I create it as a content provider and do my > >> own data access that way or, since I do not intend to publish this > >> database for anyone else to use, there is no point? Is best practice > to > >> alway wrap database access through a content provider? > >> > > KV> -- > KV> Kostya Vasilyev -- http://kmansoft.wordpress.com > > KV> -- > KV> You received this message because you are subscribed to the Google > KV> Groups "Android Developers" group. > KV> To post to this group, send email to > [email protected] > KV> To unsubscribe from this group, send email to > KV> [email protected] > KV> For more options, visit this group at > KV> http://groups.google.com/group/android-developers?hl=en > > -- > Jake Colman -- Android Tinkerer > > -- > 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 > -- Dianne Hackborn Android framework engineer [email protected] 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 [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

