暴露一个方法,跳转到index初始化页面

This commit is contained in:
2024-01-09 11:47:38 +08:00
parent 10fdade4da
commit bcfb6155d2
2 changed files with 9 additions and 1 deletions

View File

@ -336,6 +336,13 @@ public class MainActivity extends AppCompatActivity implements ResultListener{
}
};
@SuppressLint("JavascriptInterface")
@JavascriptInterface
public void openIndex() throws IOException {
runOnUiThread(() -> {
webView.loadUrl("file:///android_asset/demo/index.html");
});
}
/* 监听角度的变化
class MyOrientationDetector extends OrientationEventListener {