开发者

When is a ContentProvider really created?

I have a ContentProvider which is declared in the Manifest, w开发者_如何学Chen is it really created ? When the application is launched but before launching the first activity ? When the first query/update/insert is done ? When ?


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.


When the first query/update/insert is done. Check this

Update: android documentation is invalid in this regard. Valid behaviour is descirbed here https://stackoverflow.com/a/11858493/657487

ContentProvider created when app starts. So, it might be wise to make onCreate() lightweight

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜