How to initialize CastContext outside of onCreate method
问题 I would like to only activate the Cast feature due to certain criteria so I don't want any Cast logic in my onCreate. I have a setupCast method that has the following code: private void setupCast(String appId) { if (appId != null) { Log.d(TAG, "Setting up Cast..."); setupCastListener(); CastOptionsProvider.setAppId(appId); mCastContext = CastContext.getSharedInstance(_movieActivityContext); mCastContext.registerLifecycleCallbacksBeforeIceCreamSandwich(this, _savedInstanceState); mCastSession