I tried all the methods on the web. but the screen coming first is with an error and then when we click on the link inside the error box, it traverses to the internet but does not open in the webview. i am using Android Studio. I am getting a screen on the webview that shows following lines.
"Webpage not availble
The webpage at http://www.google.com could not be loaded beacuse:
net::ERR_CACHE_MISS"
Please help soon.
here is my code:
MainActivity.java
package com.example.shabeer.webrtc;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
public class MainActivity extends AppCompatActivity {
private WebView browser = (WebView) findViewById(R.id.web);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebSettings webSettings = browser.getSettings();
webSettings.setJavaScriptEnabled(true);
browser.loadUrl("http://beta.html5test.com/");
}
}
activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<WebView
android:id="@+id/web"
android:layout_width="match_parent"
android:layout_height="match_parent">
</WebView>