Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 22.214.171.124 release ready!
Owner and Founder. Opencart
To handle the redirect window in android Webview we have to override the “onCreateWindow” of WebChromeClient().
Android Webview is used to display HTML content or to load webpage pages in the android app.
WebView uses a WebKit engine to display web pages.To load the webpage in Webview loadUrl() and loadData() methods are used.
SomeTimes some web pages redirect to another webpage or another window on any click event. In Webview either the redirected window will not open directly.To show redirect pages in Webview we need to write some extra code.
Let’s take an example.
To show the webpage in our sample app we have written some HTML code and added that file to the assets folder.
Let’s have look at the main activity code “MainActivity.kt”.
Now if we click on the button then it will not redirect/open any new window.
To open the redirected window we have to override “onCreateWindow” of WebChromeClient().
After overriding the method, we have to create another Webview and a Dialog or view according to the requirement.Complete Main Activity Code :
After adding the above code to your app you are able to open the redirect window in your hybrid app.
In this blog, we see how we can open a redirected window in our android hybrid app or Webview.
To learn more about Webview, you can also refer to this link -> Android Webview
Thanks for Reading.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.