0

Can some help me in getting the return value of a javascript function from within android native code. The answer to this thread helped me to get the alert value of the javascript function from android java activity class but not the return value. In the following js function, if I do

echo window.localStorage["email"]

I get an alert in my java activity class. However

return window.localStorage["email"] 

does nothing and I instead I get the error cannot convert from void to String for my

MyActivity.activity.sendJavascript("userEmail();")

Here is my js function:

function userEmail() {
return window.localStorage["email"];
}
Community
  • 1
  • 1

1 Answers1

0

Try:

function userEmail() {
    var email=’’;
    email=window.localStorage["email"];
    return email;
}
SysDragon
  • 9,692
  • 15
  • 60
  • 89
Ken Nichols
  • 93
  • 2
  • 9
  • I am asking how the to get the return value from android java activity class. It works good if I do: alert('window.localStorage["email"]') but not return window.localStorage["email"]; – user2197829 Mar 22 '13 at 20:54
  • Try:http://stackoverflow.com/questions/3298597/how-to-get-return-value-from-javascript-in-webview-of-android – Ken Nichols Mar 22 '13 at 21:11