Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

onCreate of Content Provider

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?

like image 293
Smitha Avatar asked Mar 21 '12 04:03

Smitha


People also ask

What is the main function of the content provider?

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.

What is a content resolver?

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,.....)


1 Answers

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...

like image 54
5hssba Avatar answered Sep 27 '22 21:09

5hssba