title: How to fix a webview error in android?
body: <p>I'm trying to create a simple Android application that is just a webview.  I've been following a tutorial (<a href="http://www.mkyong.com/android/android-webview-example/" rel="nofollow">http://www.mkyong.com/android/android-webview-example/</a>) but have adapted it to have just a webview instead of a button that opens a webview.  </p>
  
  <p>When I include the code, I get an error on the line saying "webview cannot be resolved or is not a field".  Any ideas on how to troubleshoot?  Full code is below:</p>
  
  <p>Error where line occurs:</p>
  
  <pre><code>    setContentView(R.layout.webview);
  </code></pre>
  
  <p>MainActivity.java:</p>
  
  <p>package com.example.myfirstapp;</p>
  
  <pre><code>import android.app.Activity;
  import android.os.Bundle;
  import android.webkit.WebView;
  
  public class MainActivity extends Activity {
  
      private WebView webView;
  
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.webview);
  
          webView = (WebView) findViewById(R.id.webView1);
          webView.getSettings().setJavaScriptEnabled(true);
          webView.loadUrl("http://www.google.com");
  
      }
  
  }
  </code></pre>
  
  <p>activity_main.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;WebView  xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/webView1"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
  /&gt;
  </code></pre>