Skip to content Skip to sidebar Skip to footer

Local Html Page \raw\ Folder In Webview With Links To Another Html Page

I'm using a WebView to display a html page which is stored in the \raw\ directory so I can easily localize it. I load the page using InputStream inputStream = getResources().open

Solution 1:

Step #1: Probably use a more distinctive URL pattern for the links to help you distinguish them (e.g., <a href="/this/is/another/raw/resource/htmlPage2.html">)

Step #2: Register a WebViewClient with your WebView

Step #3: In shouldOverrideUrlLoading() of your WebViewClient, if the URL matches the pattern you use for these links (see Step #1), go through your load-the-resource logic and return true, else do nothing and return false to pop up a Web browser on that URL

Post a Comment for "Local Html Page \raw\ Folder In Webview With Links To Another Html Page"