@Override public TiUIView createView(Activity activity) { ((TiBaseActivity) activity).addOnLifecycleEventListener(this); ((TiBaseActivity) activity).addInterceptOnBackPressedEventListener(this); TiUIWebView webView = new TiUIWebView(this); if (postCreateMessage != null) { sendPostCreateMessage(webView.getWebView(), postCreateMessage); postCreateMessage = null; } return webView; }
@Override public void onDestroy(Activity activity) { TiUIWebView webView = (TiUIWebView) peekView(); if (webView == null) { return; } // We allow JS polling to continue until we exit the app. If we want to stop the polling when // the app is // backgrounded, we would need to move this to onStop(), and add the appropriate logic in // onResume() to restart // the polling. webView.destroyWebViewBinding(); WebView nativeWebView = webView.getWebView(); if (nativeWebView == null) { return; } nativeWebView.stopLoading(); super.releaseViews(); }