Creating a web browsing App for Android


#1

Error is coming in setContentView(R.layout.activity_main); that activity_main cannot be resolved or is not a field.This is my code please check this and tell me why error is occuring?

import android.R; import android.os.Bundle; import android.annotation.SuppressLint; import android.app.Activity; import android.view.Menu; import android.webkit.WebView; import android.webkit.WebViewClient;

public class MainActivity extends Activity {

@Override

protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	
}

@SuppressLint(“SetJavaScriptEnabled”) @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu);

    WebView myWebView = (WebView) findViewById(R.id.webview);
    myWebView.setWebViewClient(new WebViewClient());
    myWebView.loadUrl("http://www.mybloggertricks.com");
      return true;
}

}