How to make Android’s WebView opens a link inside or outside current app?

Initially if we use a WebView in our Android app, if there is a link and we click it, an intent manager is being called and asking how do we want to open that link. But we can manage it to open that link inside current that WebView or regular web browser.

To do so, we need to examine what kind of link is it. In this example, I tell the WebView that if the link contains some word, for example “zofiakreasi” then please open it directly, and if not then run an intent manager so users can choose how to open that link.

If you have more word to examine, you can do “else if” statement or using “or” operator inside your “if” statement.

Do you like this post? Consider a donation 😀

Published by


Habibie is an Indonesian freelance frontend-backend web programmer and cross platform mobile app developer. He's also good at graphics design, video editing, visual effects and animation.

Leave a Reply

Your email address will not be published. Required fields are marked *