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,305
  • 16
  • 71
  • 119
shaqed
  • 322
  • 3
  • 14

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,613
  • 2
  • 25
  • 55
fyales
  • 64
  • 6