I am creating an Android App and I have the following javascript which is within "str8red.com" loaded from a webview:
<script>var name = "bob", age = 30;</script>
I have a textbox that I can set using:
textView.setText("Static Text")
I would like to set my textbox to the variable from the javascript var name. I have tried to utilise webview.loadUrl("javascript:Android.getIds(Ids);"); and evaluateJavascript with no success. I have also tried to follow numerous guides on stack overflow and the the web without success.
Below is the code for loading the webview:
wv = (WebView) findViewById(R.id.wv);
//Enable JavaScript
wv.getSettings().setJavaScriptEnabled(true);
wv.setFocusable(true);
wv.setFocusableInTouchMode(true);
//Set Render Priority To High
wv.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
wv.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
wv.getSettings().setDomStorageEnabled(true);
wv.getSettings().setDatabaseEnabled(true);
wv.getSettings().setAppCacheEnabled(true);
wv.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
//Load Url
wv.loadUrl("https://str8red.com/");