title: how implement the back button in webview?
body: <p>I have a simple webview to shows a forum..i need "mapping" the back button to go back in the webpages of the forum of course. I tryied in This way but gets me a fatal error</p>
  
  <pre><code>public class MainActivity extends Activity
  {
  protected WebView webview;
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      WebView webview = (WebView) findViewById(R.id.webview);
      WebSettings websettings = webview.getSettings();
      websettings.setJavaScriptEnabled(true);
      webview.setWebViewClient(new WebViewClient());
      if (savedInstanceState == null)
      {
          webview.loadUrl("http://www.proboards.com/");
      }
  
  }
  
  @Override
  protected void onSavedInstanceState(Bundle outState) {
      //super.onSavedInstanceState(outState);
  
      webview.saveState(outState);
  }
  
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
      switch (keyCode) {
          case KeyEvent.KEYCODE_BACK:
              if(webview.canGoBack() == true)
  
                  webview.goBack();
              else finish();
              break;
  
          default:
              break;
      }
      return super.onKeyDown(keyCode, event);
  }
  }
  </code></pre>
  
  <p>The error is onKeyDown line 42.</p>