(Android Studio) Webview loads the page and does not open

Asked

Viewed 468 times

0

I am making an application that gathers some sites, but some of them keep clicking on Webview and does not open. As an example I will use the Urpay. I’ve seen this site being opened by another application, by the way opens normally as if you in Google Chrome.

File . xml

android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Mibank_Activity">


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

File . java

private WebView webView;

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

    setTitle("URPAY");

    webView = (WebView) findViewById(R.id.webview_Urpay);
    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webView.setWebViewClient(new WebViewClient());
    webView.loadUrl("https://conta.urpay.com.br/entrar");
}

The site keeps loading and never opens. That would be setting up my Webview?

1 answer

1


Add this nigga here that’s gonna be good " webSettings.setDomStorageEnabled(true); " your class will look like this

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

setTitle("URPAY");

webView = (WebView) findViewById(R.id.webview_Urpay);
WebSettings webSettings = webView.getSettings();
webSettings.setDomStorageEnabled(true);
webSettings.setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("https://conta.urpay.com.br/entrar");

}

Browser other questions tagged

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