1
Я пишу пример из html в native, но он не может прыгать. Вот мой код. H5Activity (HTML)От Html To Native
webview = (WebView) findViewById(R.id.webview);
webview.loadUrl("file:///android_asset/hello.html");
webview.addJavascriptInterface(new Object()
{
@JavascriptInterface
public void jump()
{
Intent intent = new Intent(H5Activity.this, NativeBActivity.class);
startActivity(intent);
}
}, "egos");
NativeBActivity (Родной)
setContentView(R.layout.activity_nativea);
button = (Button) findViewById(R.id.text);
button.setText("Finish");
мой hello.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8" />
<script type="text/javascript">
function flea(){
// if(egos){
egos.jump("hello");
// }
}
</script>
</head>
<body>
<p><button onclick="egos.jump()">jump to Native</button></p>
</body>
</html>
Но это не jump.I попробовать свои BES. Вы можете мне помочь?
Thx, Извините за мою небрежность. – CoolEgos
Добро пожаловать :) – JesusS