WebView always asking where I want to open the url

1

My Web View every time I try on my cell phone is asking me how I want to open the url, but I need to open it in the webview. Well the code is this:

Activity.java

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;

public class ConectActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_conect);

        String url = "http://google.com";
        WebView wv=(WebView) findViewById(R.id.webView);
        WebSettings ws = wv.getSettings();
        ws.setJavaScriptEnabled(true);
        ws.setSupportZoom(true);
        wv.loadUrl("https://google.com");


    }
}

Layout activity

<WebView
        android:id="@+id/webView"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </WebView>

And it does not manifest this:

<uses-permission android:name="android.permission.INTERNET"/>

Would someone please know how I can resolve?

    
asked by anonymous 22.10.2015 / 21:43

1 answer

2

Before calling the loadUrl() method, you must tell the webview which client to use:

String url = "http://google.com";
WebView wv=(WebView) findViewById(R.id.webView);
WebSettings ws = wv.getSettings();
ws.setJavaScriptEnabled(true);
ws.setSupportZoom(true);

wv.setWebViewClient(new WebViewClient());

wv.loadUrl("https://google.com");
    
22.10.2015 / 22:48