Instantiating a Webview

Asked

Viewed 65 times

0

I have a simple application that with a given link returns an html page. I’m doing this with a Webview, it’s working normally, but I don’t want the user to see the Webview on the mobile screen.

Before I was doing so for instance it:

WebView wv = findViewById(R.id.webview);

So I searched the net and found this way here, to instantiate without the need to create Webview on the screen:

    final WebView wv = new WebView(this);
    setContentView(wv);

But the result was the opposite, even deleting Webview in xml when I went to run the application, there was Webview on the screen, and even more occupying all the space. I wanted a way to instantiate Webview without it appearing on the screen the same, since the goal is to just take the html of the page and not show the site to the user.

  • There are other ways to get the HTML of the page without using a webview. You want HTML for some specific purpose?

  • Unfortunately not, I am scraping an academic page, the only problem is the webView on the screen. I could hide it, but it will remain on screen, wanted something that did not enter the world of the gambiarras.

  • If it’s just scraping, you can use more specific libraries like jsoup, Jaunt, among others.

  • I’m using Jsoup, however as I said I need to log in, I tried to log in via post by Jsoup (on sites like github worked well), but on the site I’m scraping I’m not getting, so I’m instantiating a webView to retrieve html.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.