Hello I started trying to develop Android applications today, but I have a problem:
I decided to try out making a Web View using this tutorial - http://developer.android.com/resources/tutorials/views/hello-webview.html
But when I put the code in for the OnCreate() method I get an "id connot be resolved or is not a field" error. Here is my code:
main.xml:
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
HelloWebView.java:
package com.example.hellowebview;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class HelloWebView extends Activity {
WebView mWebView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://www.google.com");
}
}
I have tried cleaning, CTRL+SHIFT+O, and just completely restarting the project. There error is in the statement: mWebView = (WebView) findViewById(R.id.webview); and Eclipse just says "id cannot be resolved or is not a field"
Also, I installed everything today using the guide on developer.android.com and followed all steps correctly. I have made Java programs on this computer before so I don't think there is a problem related to the JDK/JRE.