Issue
In my project I have a WebView in a fragment which loads a page from the internet. I want to set a listener on a button in that page so that when the user clicks on it I am able to move to a different fragment. I don't have the code for the webpage that is being loaded.
I was able to implement an onClick listener for the WebView itself by using this answer, but I can't think of a way to intercept the button press specifically inside the WebView.
Any suggestions on how to implement something like this? Thanks.
Solution
All the above answers were good workarounds, however, I ended up using this solution and followed the guide on Android Developers page to enable JavaScript Binding. Note that Android
interface needs to be used in the JavaScript file in order for the interception to work.
Answered By - hamrosvet
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.