title: Opening a Web View
body: <p>I have an image button that when clicked opens a new activity with a web view in.  The web view will display some custom HTML.  When I click the button the web view displays nothing.</p>
  
  <p>This is the code for my button view:-</p>
  
  <pre><code>    public void GoToContact(View view)  
  {
  
          WebView webView;
  
          setContentView(R.layout.webview);
  
          webView = (WebView) findViewById(R.id.myWebView);
          webView.getSettings().setJavaScriptEnabled(true);
  
  
          String customHtml = "&lt;html&gt;&lt;body&gt;&lt;h1&gt;Hello, WebView&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;";
             webView.loadData(customHtml, "text/html", "UTF-8");
  
  }  
  </code></pre>
  
  <p>THIS IS MY WEB VIEW LAYOUT:-</p>
  
  <pre><code>    &lt;LinearLayout
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:orientation="horizontal"&gt;
  
  
  
      &lt;ImageButton
      android:id="@+id/GoToHome"
      android:onClick="GoToTC" 
      android:background="@drawable/test"
      android:layout_width="360dp"
      android:layout_height="60dp"
      android:contentDescription="@string/header"/&gt;
  
      &lt;WebView
      android:id="@+id/myWebView"
      android:layout_width="match_parent"
      android:layout_height="400dp" /&gt;
      &lt;/LinearLayout&gt;
  </code></pre>