I have a webview in android kotlin and i want to r...
# android
k
I have a webview in android kotlin and i want to read this json defined in
postMessage
. what is best possible way for it?
google 2
stackoverflow 2
d
k
i tried but not able to find much for
postMessage()
i mostly find answers for showHtml
d
This is wrong place to ask such question. It’s not Kotlin specific. Just check the channel topic…
k
ok i guess #javascript will be good place to ask
c
I don’t think so. That channel seems to be aimed at kotlin/js code - which this is not. Though I haven’t used it myself, I recommend looking for an Android slack group like Android United. Best of luck! https://slofile.com/slack/android-united
👍 3
h
look for "@JavascriptInterface" may be it will help
r
Also try android documentation. Developers.android.com
e
hi you can use the
Copy code
@JavascriptInterface
annotation and have a when for the method and then put in what you need to do with the json inside
easiest way for webview interactions
k
thanks all for your help. i found the solution just adding for reference here is my javascript
and here is my code which uses
Copy code
@JavascriptInterface
and Toast the json