How to make webview work, I’ve tried but it doesn’t work

Asked

Viewed 393 times

1

I’ve tried everything but my webview doesn’t work. help me

the java code

public class Telairlanda extends Appcompatactivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tela_irlanda);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();




   WebView wv=(WebView)findViewById(R.id.webView1);

            WebSettings ws = wv.getSettings();
            ws.setJavaScriptEnabled(true);
            ws.setSupportZoom(false);

            wv.loadUrl("https://www.google.com");
  • What doesn’t work? See if this reply resolves.

  • The code is correct, but look if you put internet access permission

  • I put the permission in the manifest <? xml version="1.0" encoding="utf-8"? > <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.junior.intercambio"> <uses-permission android:name="android.permission.INTERNET"></uses-permission>

  • Then try to put "wv.setWebViewClient(new Webviewclient());" before loadUrl

  • Hello, You are trying on android 6? if yes it is necessary to request permission at runtime https://inducesmile.com/android-6-marshmallow-runtime-permissions-request-example/

  • @Joãofelipe The permission android.permission.INTERNET does not belong to the list of dangerous permissions, therefore your request at runtime is not necessary.

Show 1 more comment
No answers

Browser other questions tagged

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