lukemovement
Member
all works fine untiil i add the script for the back button.
for both of the problems it displays
"Cannot make a static reference to the non-static method goBack() from the type WebView"
anyone know whats wrong with the script??
Code:
package com.lukemovement.gt540blog;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class GT540Blog extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.loadUrl("http://www.example.com");
WebView myWebView1 = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView1.getSettings();
webSettings.setJavaScriptEnabled(true);
WebView myWebView11 = (WebView) findViewById(R.id.webview);
myWebView11.setWebViewClient(new WebViewClient());
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && WebView.canGoBack()) { <---Problem
WebView.goBack(); <---Problem
return true;
}
return super.onKeyDown(keyCode, event);
}
}
for both of the problems it displays
"Cannot make a static reference to the non-static method goBack() from the type WebView"
anyone know whats wrong with the script??