我有一个登录html页面,它在Webview中加载,如下所示
WebView loginScreen = (WebView) findViewById(R.id.loginWebView);
final JavaScriptInterface myJavaScriptInterface = new JavaScriptInterface(this);
loginScreen.addJavascriptInterface(myJavaScriptInterface, "AndroidFunction");
loginScreen.getSettings().setJavaScriptEnabled(true);
//myBrowser.loadUrl("file:///android_asset/www/index.html");
loginScreen.loadUrl("file:///android_asset/www/login.html");
loginScreen.requestFocus(View.FOCUS_DOWN);
// and a key up event event after updating the username and password to get the key Events
public boolean onKeyUp(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
if(keyCode == KeyEvent.KEYCODE_ENTER){
Toast.makeText(this, "coming insied", Toast.LENGTH_LONG).show();
}
return super.onKeyDown(keyCode, event);
}
but when i press go/enter button its not firing (Toast is not being displayed) the event, kindly let me know where am i going wrong
我也尝试过使用KeyDown& dispatchKey事件没有工作
Thanks in Advance,
Nagendra.