I found that onCreate of ContentProvider gets called first, even before the onCreate of my Activity. eg: Vogella Android SqlLite.
But I wanted to know how does it happen and why?
Is it because we register it as a provider in the Manifest?
A content provider manages access to a central repository of data. A provider is part of an Android application, which often provides its own UI for working with the data. However, content providers are primarily intended to be used by other applications, which access the provider using a provider client object.
Content Resolver resolves a URI to a specific Content provider. Content Provider provides an interface to query content. The way to query a content provider is contentResolverInstance. query(URI,.....)
onCreate is to initialize your content provider on startup. This method is called for all registered content providers on the application main thread at application launch time.. yes ,it is because you register them in manifest...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With