Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When is a ContentProvider really created?

I have a ContentProvider which is declared in the Manifest, when is it really created ? When the application is launched but before launching the first activity ? When the first query/update/insert is done ? When ?

like image 560
fedj Avatar asked Aug 14 '10 15:08

fedj


People also ask

What is a ContentProvider and what is it typically used for?

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.

How can an application activate ContentProvider?

Create a class in the same directory where the that MainActivity file resides and this class must extend the ContentProvider base class. To access the content, define a content provider URI address. Create a database to store the application data. Implement the six abstract methods of ContentProvider class.

What is an intent can it be used to provide data to a ContentProvider?

An Intent is involved when we start an activity, start or bind to a service, or send a broadcast. However, comparing an Intent to a ContentProvider is akin to comparing a shovel with a boot, arguing that both can be used to carry dirt.

What is the purpose of the ContentProvider class in Android?

A content provider manages access to a central repository of data. You implement a provider as one or more classes in an Android application, along with elements in the manifest file. One of your classes implements a subclass ContentProvider , which is the interface between your provider and other applications.


1 Answers

From http://developer.android.com/reference/android/content/ContentProvider.html#onCreate():

Implement this 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. It must not perform lengthy operations, or application startup will be delayed.

like image 138
James Wald Avatar answered Oct 13 '22 06:10

James Wald