Android: Pull HTML and Process it -


"postprint" itemprop = "text">

I used to get the HTML for a site I used to have to pull the information from, but the website Anyone can use (server side, only client side).

I am able to drag html through javascript. But when I run my code, my data field is not updated because it loads before my JavaScript finishes. I want to process data through JSOUP later. It is difficult to get along with HTTPCLient because it has a website with a login, and it is SSL secure I can get it through WebView (manual entry) and then drag data later.

Is there a way to get or login to the past, or until all this is to wait in the second formula of loading HTML data?

  OnClickListener {TextView data; on the implementation of the main activity activity of the public class; Button getRost; WebView WebView; String code; @ Override protected void saved create (bundled Instansstet) {Suprknkret (saved Instensstet); SetContentView (R.layout.activity_main); Data = (textview) Find VVBIID (RIDTVTData); GetRost = (Button) findViewById (R.id.btGet); GetRost.setOnClickListener (this); Find webview = (webview) VVBIID (R.D.W.V.); } @Override Public Zero onClick (see arg0) {// TODO Auto-built method stub switch (arg0.getId ()) {case R.id.btGet: webview.getSettings () setJavaScriptEnabled (true) ;. Webview.addJavascriptInterface (new MyJavaScriptInterface (this), "HtmlViewer"); Webview.setWebViewClient (New WebViewClient) {@Override Public Zero onPageFinished (WebView to view, string URL) {webview.loadUrl ("javascript: window.HtmlViewer.showHTML" + '(' top & gt; '+ Document.getElementsByTagName ('Html') [0]. WinnerHTML + '& lt; / head & gt;'); ");}}); Webview.loadUrl ("URLTHATCONTAINTSINFO"); Data.setText (code); }} Class MyJavaScriptInterface {private context CTX; MyJavaScriptInterface (reference CTX) {this.ctx = ctx; } Public Zero ShowHTML (String HTML) {New AlertDialog.Builder (ctx) .setTitle ("HTML"). SetMessage (html) .setPositiveButton (android.R.string.ok, tap) .setCancelable (wrong) .create (). Show (); Code = html; }}}}    

If the site is using a self-signed certificate, You should be able to create your own SSL client, and you can see if the log-in has been sent to the site to handle it. Send it through post.

If this is using full SSL certificate, then just post data ...

In any way, webview process will result from there < P> Example:.

  Private Zero launchWeb () {webview = new webview (this); // where myWebview WebView object is webview.setWebChromeClient (new WebChromeClient ()); Webview.setWebViewClient (new MyWebViewClient ()); Webview.clearCache (right); Webview.clearHistory (); Webview.getSettings () setJavaScriptEnabled (true). . Webview.getSettings () setJavaScriptCanOpenWindowsAutomatically (true); Webview.requestFocus (View.FOCUS_DOWN); String postdata = "user name =" + _username + "& amp; password =" + _password; Webview.postUrl ("https://blahblah.com/somepath", encoding multi.getBytes (PostData, "BASE64")); }    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -