1

I've been following this series of Android Development Tutorials and I've encountered some problem trying to tweak one of the projects I've created.

Basically all I want to know is how to apply the WebView correctly in my project - in the easiest and most simple way possible.

What I've done: enabled permission to the internet on the manifest created the webview on the main_activity.xml imported the WebView webkit to my MainActivity Java class

And all I've done after that is simply loading the url on my onCreated method like this:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    WebView v = (WebView) findViewById(R.id.weblol);
    v.loadUrl("www.google.com");
}    

However nothing seems to happen and the block of the WebView remains blank white

Care to explain to a noob what am I doing wrong ?

MysticMagicϡ
  • 28,593
  • 16
  • 73
  • 124
shaqed
  • 342
  • 3
  • 17

1 Answers1

1

You should use http://www.google.com instead of www.google.com.
Only you to this,webview can notice this it is a URL.

Otherwise.you can use local file in webview ,like file:///android_asset/xxx in assets folder.
That's all.

Pratik
  • 1,531
  • 3
  • 25
  • 57
fyales
  • 64
  • 6