[android-developers] Re: Custom Content Provider and Multiple Tables
hi..i am using sync adapter in my application with one provider now..can i make another provider?can i sync two provider at a time?..plz help me..all example is using only one provider for sync operation can i possible to use two provider for sync? On Tuesday, August 26, 2008 12:34:21 AM UTC+5:30, Lonzo1968 wrote: > > Does anyone have an example of creating a custom ContentProvider that > accesses multiple tables? Since the ContentProvider interface has a > single insert, update, query, delete methods, and as far as I can see, > you can only include one ContentProvider in your application. > > What if I have 2 tables Employee and Department for example.. do I > handle the different inserts, etc.. with a Case statement in the > method and a URI? Seems to me this lend itself to some code that could > get unruley. > > Thanks, > > LA > -- 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
[android-developers] Re: Custom Content Provider and Multiple Tables
Lonzo1968 wrote: > I got you book from commonsware.com. I like what you have done so far, > especially the detail on the layouts. Thanks! > What is the best architecture for this ContentProvider situation? > Should I have a Provider for each table or muliple tables in a single > provider. Maybe I'm missing something here, since I'm used to very > different database layers (like the DAO pattern for example). Well, hackbod responded on this question, and she's *WAY* more authoritative than I am on Android. I'd follow her recommendations. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 1.1 Published! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new Android 0.9 SDK beta! http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Custom Content Provider and Multiple Tables
If any of your tables have relationships between them, you almost certainly want them in one content provider to be able to do joins and other complicated operations across them. Look at the contacts provider protocol for an example. http://code.google.com/android/reference/android/provider/Contacts.html And it is entirely possible for one .apk to have multiple top-level content providers. On Aug 26, 6:50 pm, Lonzo1968 <[EMAIL PROTECTED]> wrote: > Thanks Mark, > > I got you book from commonsware.com. I like what you have done so far, > especially the detail on the layouts. > > What is the best architecture for this ContentProvider situation? > Should I have a Provider for each table or muliple tables in a single > provider. Maybe I'm missing something here, since I'm used to very > different database layers (like the DAO pattern for example). > > On Aug 25, 5:48 pm, "Mark Murphy" <[EMAIL PROTECTED]> wrote: > > > > Since the ContentProvider interface has a > > > single insert, update, query, delete methods, and as far as I can see, > > > you can only include one ContentProvider in your application. > > > ContentProviders are managed by their MIME type/URI patterns. An > > application should be able to have several providers, or a singleprovider > > that handles several sorts of data. > > > If you want a single ContentProvider to handle multiple URI patterns, use > > a UriMatcher: > > >http://code.google.com/android/reference/android/content/UriMatcher.html > > > -- > > Mark Murphy (a Commons Guy)http://commonsware.com > > _The Busy Coder's Guide to Android Development_ Version 1.1 Published! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new Android 0.9 SDK beta! http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Custom Content Provider and Multiple Tables
Thanks Mark, I got you book from commonsware.com. I like what you have done so far, especially the detail on the layouts. What is the best architecture for this ContentProvider situation? Should I have a Provider for each table or muliple tables in a single provider. Maybe I'm missing something here, since I'm used to very different database layers (like the DAO pattern for example). On Aug 25, 5:48 pm, "Mark Murphy" <[EMAIL PROTECTED]> wrote: > > Since the ContentProvider interface has a > > single insert, update, query, delete methods, and as far as I can see, > > you can only include one ContentProvider in your application. > > ContentProviders are managed by their MIME type/URI patterns. An > application should be able to have several providers, or a singleprovider > that handles several sorts of data. > > If you want a single ContentProvider to handle multiple URI patterns, use > a UriMatcher: > > http://code.google.com/android/reference/android/content/UriMatcher.html > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > _The Busy Coder's Guide to Android Development_ Version 1.1 Published! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new Android 0.9 SDK beta! http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Custom Content Provider and Multiple Tables
> Since the ContentProvider interface has a > single insert, update, query, delete methods, and as far as I can see, > you can only include one ContentProvider in your application. ContentProviders are managed by their MIME type/URI patterns. An application should be able to have several providers, or a single provider that handles several sorts of data. If you want a single ContentProvider to handle multiple URI patterns, use a UriMatcher: http://code.google.com/android/reference/android/content/UriMatcher.html -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 1.1 Published! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new Android 0.9 SDK beta! http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---