if webview html content has few <img> tags, is it possible to opens that image in fullscreen mode in new activity when user hit image in webview?
if webview html content has few <img> tags, is it possible to opens that
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes it is. basically it is possible to invoke any kind of native Android code from within a
WebView. You define the methods you want to expose for calling from within theWebViewin a class, pass an instance of this class to theWebViewand from then on the methods are invocable just like javascript methods. here comes the example (this is copy-pasted form another answer of mine; you will need to replace the video intent with image displaying intent):Calling native code from within web view:
When creating the web view add javascript interface (basically java class whose methods will be exposed to be called via javascript in the web view).
The definition of the javascript interface class itself (this is examplary class I took from another answer of mine and opens video in native intent)
Now if yo want to call this code form the html of the page you provide the following method:
So you need to add the appropriate method to
JSInterfaceand call the code from within the Web App.