How do I catch content provider initialize?

后端 未结 2 1700
孤街浪徒
孤街浪徒 2020-12-29 05:22

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 p

2条回答
  •  借酒劲吻你
    2020-12-29 05:55

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

    
    

    public class ApplicationController extends Application {
        @Override
        protected void attachBaseContext(Context base) {
            super.attachBaseContext(base);
    
            // some of your own operations before content provider will launch
        }
    }
    

提交回复
热议问题