0

I hava a programme contains java and javascript(webview). Now, in java

String vi = "I am a student";

In javascript

var fromvi;

How can I get the value in java String "vi" and set this value into javascript var "fromvi"? Thanks!

SPG
  • 5,691
  • 11
  • 42
  • 72
  • Need some more context. Where does the Javascript live? This is tagged Android. So is this a WebView embedded in your activity? – Thilo Aug 02 '11 at 09:53
  • I believe you are searching for something like this : http://stackoverflow.com/questions/4325639/android-calling-javascript-functions-in-webview – Rudy Aug 02 '11 at 09:53

1 Answers1

2

AddJavascriptInterface will allow you to bind a Java object to a WebView and control it with Javascript.

Paddy
  • 2,605
  • 1
  • 18
  • 27