I have a JavascriptInterface and a setter/getter in my Android code:
mWebView.addJavascriptInterface(new AccessibleMethods(), "Android");
private class AccessibleMethods {
private boolean isWorking;
public void setIsWorking(boolean working)
{
this.isWorking = working;
// A toast message here of this.isWorking displays true
}
public boolean getIsWorking()
{
return this.isWorking;
}
}
In my JavaScript code I call the function:
Android.setIsWorking(true);
But when I try to access isWorking in Java in another method or outside the class, it doesn't have the correct value.
AccessibleMethods methods = new AccessibleMethods();
methods.getIsWorking(); // returns wrong or no value
I need this for accessing a JavaScript variable onKeyDown.
Any suggestions?