我如何赶上内容提供商初始化? [英] How do I catch content provider initialize?

查看:105
本文介绍了我如何赶上内容提供商初始化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如我们所知道的应用程序运行内容提供商负荷。但是,我想作一些操作之前,内容提供商将推出。我该如何抓住这个操作?在内容提供商的onCreate方法将被称为

As we know content provider loads on application run. But I want to make some operations before content provider will launch. How do I catch this operation? Before content provider's onCreate method would be called

推荐答案

我认为香港专业教育学院找到解决方案。香港专业教育学院建立了我的自定义应用程序类,并重写attachBaseContext方法

I think Ive found solution. Ive created my custom application class and overridden attachBaseContext method

<application android:name=".ApplicationController" ...>


public class ApplicationController extends Application {
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);

        // some of your own operations before content provider will launch
    }
}

这篇关于我如何赶上内容提供商初始化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆