Issue
I have created an application that requires the popupMenu to be displayed when a particular link is clicked in the html file.
Now I am not sure how I can get the click event for the link to open the popupMenu. Can anyone please advise? Am I going at this the right way?
Solution
Craete a WebViewClient
for your WebView
.
Now each time the user clicks a link, the function shouldOverrideUrlLoading
is called and the link pressed is passed as a String parameter. In this way, you can catch when your user clicked the link by checking this url parameter (second param of the function).
Finally, when you catch that the link is pressed, you show the popup.
webview.setWebViewClient(new WebViewClient()
{
public boolean shouldOverrideUrlLoading(WebView view, String url) {
//if the url is your popup url
//show the popup
//if you want the web view to load the url return false; else return true;
//by default return false btw!
}
});
Answered By - Sherif elKhatib
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.