Webview does not show the page

Asked

Viewed 518 times

1

I set up my WebView to display the privacy policy of my application, but when opening it appears that the web page is not available. See:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    WebView webView = (WebView) findViewById(R.id.wv_content);
    webView.loadUrl("https://paivadeveloperpolitica.wordpress.com/2017/03/28/politica-de-privacidade/");
}

I have tried several ways, apart from HTTOS, leaving only HTTP, only www. but in no way worked.

<RelativeLayout 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:background="@android:color/white">

  <WebView
      android:id="@+id/wv_content"
      android:layout_width="match_parent"
      android:layout_height="match_parent"/>

</RelativeLayout>
  • 1

    Granted internet access permission on Androidmanifest?

  • That’s right, I’m very dumb kk

1 answer

2


The way you are doing it is correct, however you need to grant permission to access the internet in your AndroidManifest.xml to open the page through your WebView. See below:

<uses-permission android:name="android.permission.INTERNET" />
  • @normal Paiva... I’ve also caught a lot.

  • Kkkkk is hard

Browser other questions tagged

You are not signed in. Login or sign up in order to post.