第三方浏览器内核嵌入一、Crosswalk

时间:2025-04-02 10:20:04
public class MainActivity extends Activity { @Bind(R.id.xWalkWebView) XWalkView xWalkWebView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); xWalkWebView.load("", null); // 开启调试 XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true); } /**通过Activity管理XWalkWebView的声明周期*/ @Override protected void onPause() { super.onPause(); if (xWalkWebView != null) { xWalkWebView.pauseTimers(); xWalkWebView.onHide(); } } @Override protected void onResume() { super.onResume(); if (xWalkWebView != null) { xWalkWebView.resumeTimers(); xWalkWebView.onShow(); } } @Override protected void onDestroy() { super.onDestroy(); if (xWalkWebView != null) { xWalkWebView.onDestroy(); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (xwv != null) { xwv.onActivityResult(requestCode, resultCode, data); } } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if (xwv != null) { xwv.onNewIntent(intent); } } }

相关文章