I am using the web view commands to display a webpage. My question is, “Is there a command to actually take only a box of the webpage with a declared size zoom too it and lock the screen around it?”
Basically I’m trying to remove a server status section of the webpage and display the zoomed portion on the phone on click. Below is my web view file calling to Google, but that will change to the rel site in the future.
If possible I would like to compress this box to fit to the size of the phone screen, landscape or otherwise.
EDIT: I have done a bit of research and reading. I’m going to try to work with Jsoup. Unfortunately after reading documentation and examples of webpage “scraping” I am unable to figure out how to load webpage HTML as document -> search document for target code -> display target code on layout.
As you can see I started to try to do this in webview, and I may in the future try to do the out to layout through webview.
Any help understanding this better would b appreciated!
EDIT 2: Added some more scrape code, this seems like it could do what I want but I’m unclear on how to reference the variables in the HTML code to display.
Here is the HTML that I am working with, followed by the code I’m using:
<div class="page-header">
<h2 class="header "> Server Status
</h2>
<div class="desc">
This page lists all available Diablo III game and auction house servers, as well as the status of each – either available or undergoing maintenance.
</div>
<span class="clear"><!-- --></span>
</div>
<div class="server-status">
<div class="db-directory">
<div class="db-directory-inner">
<div class="column column-1">
<div class="box">
<h3 class="category">Americas</h3>
<div class="server-list">
<div class="server">
<div class="status-icon up" data-tooltip="Available">
</div>
<div class="server-name">
Game Server
</div>
<span class="clear"><!-- --></span>
</div>
</div>
<h4 class="subcategory">Auction House</h4>
<div class="server-list">
<div class="server">
<div class="status-icon up" data-tooltip="Available">
</div>
<div class="server-name">
Gold
</div>
<span class="clear"><!-- --></span>
</div>
<div class="server alt">
<div class="status-icon up" data-tooltip="Available">
</div>
<div class="server-name">
Hardcore
</div>
<span class="clear"><!-- --></span>
</div>
<div class="server">
<div class="status-icon up" data-tooltip="Available">
</div>
<div class="server-name">
USD
</div>
<span class="clear"><!-- --></span>
</div>
<div class="server alt">
<div class="status-icon up" data-tooltip="Available">
</div>
<div class="server-name">
AUD
</div>
<span class="clear"><!-- --></span>
</div>
<div class="server">
<div class="status-icon up" data-tooltip="Available">
</div>
<div class="server-name">
MXN
</div>
<span class="clear"><!-- --></span>
</div>
<div class="server alt">
<div class="status-icon down" data-tooltip="Maintenance">
</div>
<div class="server-name">
BRL
</div>
<span class="clear"><!-- --></span>
</div>
<div class="server">
<div class="status-icon down" data-tooltip="Maintenance">
</div>
<div class="server-name">
CLP
</div>
<span class="clear"><!-- --></span>
</div>
<div class="server alt">
<div class="status-icon down" data-tooltip="Maintenance">
</div>
<div class="server-name">
ARS
</div>
<span class="clear"><!-- --></span>
</div>
package d3.link;
import java.io.File;
import java.io.IOException;
import d3.link.R;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import org.jsoup.Connection;
import org.jsoup.Connection.Response;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import android.widget.TextView;
public class ServerStatusActivity extends Activity
{
//WebView webView;
public static void main(String[] args) throws Exception
{
String url = "http://us.battle.net/d3/en/status";
Document doc = Jsoup.connect(url).get();
String serverstatus = Document.select().text();
System.out.println("Server Status: " + serverstatus);
Elements answerers = Document.select();
for (Element answerer : answerers)
{
System.out.println("Answerer: " + answerer.text());
}
}
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.ss);
//webView = (WebView) findViewById(R.id.webView1);
//webView.getSettings().setJavaScriptEnabled(true);
//webView.getSettings().setSupportZoom(false);
//webView.getSettings().setBuiltInZoomControls(false);
//webView.getSettings().setLoadWithOverviewMode(true);
//webView.getSettings().setUseWideViewPort(true);
//webView.loadUrl("http://us.battle.net/d3/en/status");
}
}
}
Use XPath to select the server status HTML (//div[@class=”server-status”]) and then just render this part.