Code:
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.webkit.WebView;
import android.widget.Toast;
import android.webkit.WebViewClient;
public class BWinBrowserActivity extends Activity {
WebView webview;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("");
}
public boolean uiOverrideKeyEvent(KeyEvent event) {
if (webview != null) {
return webview.shouldOverrideKeyEvent(webview, event);
}
return false;
}
}
I have the following code. I'm trying to disable the complete default keyhandling by the webview component (the complete keyhandling is done by the loaded webpage in javascript).
However, the shouldOverrideKeyEvent isn't working. Eclipse 3.5.2 return 'the method shouldOverrideKeyEvent is undefined for the type Webview'.
However, if I check the Android documentation, it says shouldOverrideKeyEvent is a method of WebView.
How to fix this?