“Hello, WebView” tutorial opens the requested address in Android browser and not in my webview

前端 未结 1 719
我寻月下人不归
我寻月下人不归 2020-12-10 13:29

I am using Android emulator with AVD of Android 2.1 and I have the following problem: Trying to load a URL in a WebView using webView.loadUrl causes it to o

1条回答
  •  -上瘾入骨i
    2020-12-10 13:47

    The URL you are trying to visit probably has a redirect. Redirects behave like link clicks and will by default open in the Browser. Make sure the URL you are visiting does not do a redirect (e.g., HTTP 301 response), or use WebViewClient and shouldOverrideUrlLoading() to catch these and re-route them back to the WebView.

    0 讨论(0)
提交回复
热议问题