ContentProvider 何时真正创建?

发布于 2024-09-14 16:47:07 字数 91 浏览 1 评论 0原文

我有一个在清单中声明的​​ ContentProvider,它是什么时候真正创建的?当应用程序启动时但在启动第一个活动之前?第一次查询/更新/插入何时完成?什么时候 ?

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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

入画浅相思 2024-09-21 16:47:07

来自 http://developer.android.com/reference/android/内容/ContentProvider.html#onCreate()

实现此功能可在启动时初始化您的内容提供程序。在应用程序启动时,为应用程序主线程上所有注册的内容提供程序调用此方法。它不能执行冗长的操作,否则应用程序启动将被延迟。

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.

烛影斜 2024-09-21 16:47:07

当第一次查询/更新/插入完成时。检查

更新:android文档在这方面无效。此处描述了

应用启动时创建的 https://stackoverflow.com/a/11858493/657487 ContentProvider 的有效行为。因此,让 onCreate() 变得轻量级可能是明智的

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文