views:

949

answers:

1

Hi there,

I'm new in android development and I am trying out the WebView example in the official android site.

http://developer.android.com/guide/tutorials/views/hello-webview.html

But I do everything they say...which is pretty simple: I create the project, edit the layout file, then i add the code, etc. No problems building...but when I launch the app in the simulator I just got a black screen. It is like if the Layout is empty...like if the WebView is not created.

does anybody know what I am doing wrong?

Thanks in advanced

+2  A: 
Roman Nurik
Hi Roman,Thanks for your answer. I've tried the new tutorial and I made it work, although it has a bug too. In the layout, when opening the WebView tag...is hast to be like this:<WebView xmlns:android="http://schemas.android.com/apk/res/android"If not.. it won't build.
arakn0
Can you tell me exactly what happened w/ the old example? You mentioned that the error is that setContentView wasn't being called, but I was calling. My onCreate method looked like this: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); webview = (WebView) findViewById(R.id.webview); webview.getSettings().setJavaScriptEnabled(true); webview.loadUrl("http://www.google.com"); )I have the same code in other project and it works, but the layout file is different.thanks in advance!
arakn0
You're right about the new tutorial -- it's missing `xmlns:android`. The old tutorial was missing `setContentView` but I'm not sure what other error you were having besides that. If you post all of your previous code, someone may be able to spot the error.
Roman Nurik