javascript - Pulling a single variable off a webview in android? -


i need pull value hidden div tag when using webview. have turned on javascript in webview activity not liking "". how can achieve goal?

public class buttonone extends activity{   webview wb = null;   /** called when activity first created. */  @override  public void oncreate(bundle savedinstancestate) {   super.oncreate(savedinstancestate);   setcontentview(r.layout.buttons);   wb = new webview(this);   wb.getsettings().setjavascriptenabled(true);   wb.setwebviewclient(new hellowebviewclient());   wb.getsettings().setjavascriptenabled(true);   wb.loadurl("http://ishopstark.com/mobileapp.php?category=1");   setcontentview(wb);   }   private class hellowebviewclient extends webviewclient {    public boolean shouldoverrideurlloading(webview view, string url) {    view.loadurl(url);    <script type="text/javascript">      {         var varsendtext = document.getelementbyid("sendtextcoupon").value;        }      </script>     return true;   }  } 

here's short example of how inject javascript webview.

if want value , use in java code, you're going have register javascriptinterface in example - extracting html webview


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -