0

I've got a simple android app with an embeded browser. Here it is:

WebView webview = new WebView(this);

setContentView(webview);

webview.loadUrl("192.168.1.106");

I'm running a web server on '192.168.1.106'. This server is alive and well and accessible through the web browser on the phone. When I start the app I get a 'Web Page not Available'. If I change the app to:

webview.loadUrl("http://google.com");

everything works. Am I missing something?

Conrad Lewis
  • 55
  • 1
  • 12

2 Answers2

0

You have to specify http:// even when IP is used.

webview.loadUrl("http://192.168.1.106");

To force the webpage to always load into WebView (not external browser), add this line before the loadUrl call.

viewer.setWebViewClient(new WebViewClient());

See this answer: link

Community
  • 1
  • 1
lopisan
  • 7,720
  • 3
  • 37
  • 45
  • This partially fixed it. However, the app now launches a browser outside of the app when I have http:// 192.168.1.106. When I have http:// google.com it is loaded in the embedded browser. – Conrad Lewis May 15 '13 at 16:10
  • I've updated answer to show, how to force the webpage to load always into ebedded browser. – lopisan May 16 '13 at 09:41
0

webview.loadUrl("http://192.168.1.106:8080") put your http port to the end of the ip address