Skip to content

2_init in Application

水牛 edited this page Nov 17, 2017 · 1 revision

delivery AppContext

invoke in the onCreate() method of your BaseApplication

StyledDialog.init(this);

registerActivityLifecycleCallbacks and get the activity obj reference

 private void registCallback() {
    registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
        @Override
        public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
            ActivityStackManager.getInstance().addActivity(activity);

        }

        @Override
        public void onActivityStarted(Activity activity) {

        }

        @Override
        public void onActivityResumed(Activity activity) {
        }

        @Override
        public void onActivityPaused(Activity activity) {

        }

        @Override
        public void onActivityStopped(Activity activity) {

        }

        @Override
        public void onActivitySaveInstanceState(Activity activity, Bundle outState) {

        }

        @Override
        public void onActivityDestroyed(Activity activity) {
            ActivityStackManager.getInstance().removeActivity(activity);
        }
    });
}