- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在以下行设置断点:
doc = Jsoup.connect(params[0]).get();
但由于某种原因,当我尝试从这一行开始跳过时,它会跳到该行
} catch (IOException e) {
e.printStackTrace();
并抛出异常(因此永远不会获得标题值),我不确定为什么。
有什么建议吗?
package com.example.test;
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends Activity {
TextView tv;
String url = "http://sheriff.org/apps/arrest/results.cfm?lname=ABBOTT&fname=LAUREA";
String tr;
Document doc;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tv = (TextView) findViewById(R.id.TextView01);
new MyTask().execute(url);
}
private class MyTask extends AsyncTask<String, Void, String> {
ProgressDialog prog;
String title = "";
@Override
protected void onPreExecute() {
prog = new ProgressDialog(MainActivity.this);
prog.setMessage("Loading....");
prog.show();
}
@Override
protected String doInBackground(String... params) {
try {
doc = Jsoup.connect(params[0]).get();
Element tableElement = doc.select(".datagrid").first();
Elements tableRows = tableElement.select("tr");
for (Element row : tableRows) {
Elements cells = row.select("td");
if (cells.size() > 0) {
title = cells.get(0).text() + "; "
+ cells.get(1).text() + "; "
+ cells.get(2).text() + "; "
+ cells.get(3).text();
}
}
} catch (IOException e) {
e.printStackTrace();
}
return title;
}
@Override
protected void onPostExecute(String title) {
super.onPostExecute(title);
prog.dismiss();
tv.setText(title);
}
}
}
日志:
10-07 15:42:21.591: I/Adreno200-EGLSUB(7981): <ConfigWindowMatch:2165>: Format RGBA_8888.
10-07 15:42:21.611: D/memalloc(7981): ion: Mapped buffer base:0x5cbaa000 size:122880 offset:0 fd:60
10-07 15:42:21.611: E/(7981): Can't open file for reading
10-07 15:42:21.611: E/(7981): Can't open file for reading
10-07 15:42:21.621: I/Adreno200-EGLSUB(7981): <ConfigWindowMatch:2165>: Format RGBA_8888.
10-07 15:42:21.641: D/memalloc(7981): ion: Mapped buffer base:0x5ccd6000 size:614400 offset:0 fd:64
10-07 15:42:21.681: D/memalloc(7981): ion: Mapped buffer base:0x5cf02000 size:122880 offset:0 fd:67
10-07 15:42:21.721: D/memalloc(7981): ion: Mapped buffer base:0x5d166000 size:614400 offset:0 fd:70
10-07 15:42:21.771: D/memalloc(7981): ion: Mapped buffer base:0x5d2fc000 size:122880 offset:0 fd:74
10-07 15:42:22.091: W/System.err(7981): java.net.UnknownHostException: Unable to resolve host "sheriff.org": No address associated with hostname
10-07 15:42:22.281: W/System.err(7981): at java.net.InetAddress.lookupHostByName(InetAddress.java:463)
10-07 15:42:22.281: W/System.err(7981): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:279)
10-07 15:42:22.281: W/System.err(7981): at java.net.InetAddress.getAllByName(InetAddress.java:253)
10-07 15:42:22.281: W/System.err(7981): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:71)
10-07 15:42:22.281: W/System.err(7981): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
10-07 15:42:22.281: W/System.err(7981): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
10-07 15:42:22.281: W/System.err(7981): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
10-07 15:42:22.291: W/System.err(7981): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
10-07 15:42:22.291: W/System.err(7981): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
10-07 15:42:22.291: W/System.err(7981): at libcore.net.http.HttpEngine.connect(HttpEngine.java:303)
10-07 15:42:22.291: W/System.err(7981): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
10-07 15:42:22.291: W/System.err(7981): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
10-07 15:42:22.291: W/System.err(7981): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
10-07 15:42:22.291: W/System.err(7981): at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:425)
10-07 15:42:22.291: W/System.err(7981): at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:410)
10-07 15:42:22.291: W/System.err(7981): at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:164)
10-07 15:42:22.291: W/System.err(7981): at org.jsoup.helper.HttpConnection.get(HttpConnection.java:153)
10-07 15:42:22.291: W/System.err(7981): at com.example.test.MainActivity$MyTask.doInBackground(MainActivity.java:46)
10-07 15:42:22.291: W/System.err(7981): at com.example.test.MainActivity$MyTask.doInBackground(MainActivity.java:1)
10-07 15:42:22.291: W/System.err(7981): at android.os.AsyncTask$2.call(AsyncTask.java:264)
10-07 15:42:22.291: W/System.err(7981): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
10-07 15:42:22.301: W/System.err(7981): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
10-07 15:42:22.301: W/System.err(7981): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
10-07 15:42:22.301: W/System.err(7981): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
10-07 15:42:22.301: W/System.err(7981): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
10-07 15:42:22.301: W/System.err(7981): at java.lang.Thread.run(Thread.java:856)
10-07 15:42:22.301: W/System.err(7981): Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname)
10-07 15:42:22.301: W/System.err(7981): at libcore.io.Posix.getaddrinfo(Native Method)
10-07 15:42:22.301: W/System.err(7981): at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:55)
10-07 15:42:22.301: W/System.err(7981): at java.net.InetAddress.lookupHostByName(InetAddress.java:448)
10-07 15:42:22.301: W/System.err(7981): ... 25 more
10-07 15:42:22.311: D/memalloc(7981): ion: Unmapping buffer base:0x5cbaa000 size:122880
10-07 15:42:22.311: D/memalloc(7981): ion: Unmapping buffer base:0x5cf02000 size:122880
10-07 15:42:22.311: D/memalloc(7981): ion: Unmapping buffer base:0x5d2fc000 size:122880
10-07 15:42:22.311: D/memalloc(7981): ion: Mapped buffer base:0x5ca92000 size:614400 offset:0 fd:54
最佳答案
我的 list 中缺少互联网权限,导致无法访问 URL。
关于java - 调试器将无法到达断点 - 而是引发异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19233197/
我正在尝试制作一个程序,显示飞机到达和起飞的时间表,然后要求用户在 C 中输入时间。然后程序将找到最接近输入时间的到达时间用户。问题是它没有按预期工作,并且给我一个错误的到达时间,甚至不接近输入的时间
我有一个不断填充新信息行的 Excel 表,其中一列与联系客户的日期(有时为空 - 无需输入日期)相关,如果在 10 内没有收到回复从那以后的几天,我们必须发送提醒,如果过了 17 天,我们必须取消订
实际到达很简单,标签进入接收器天线范围,但是偏离是造成问题的原因。 首先,我们了解一些有关设置的信息。 标签: 它们以433Mhz的速度工作,每1.5秒钟发送一次“心跳”,移动时进入传输突发模式,这种
我构建了这段代码来从 URL 获取 XML我使用了 AsyncTask,当到达 getInputStream() 点时,半身应用程序仍然崩溃 重点是我想从 url 获取 XML 作为字符串。 我尝试不
所以我有一个 TDBGrid,我的目的是搜索 DBGrid 的 Fieldname 并将其与我的编辑的 Text 属性进行比较,如果它们相等,则 我想将找到匹配项的整列写入列表框。 通过带有 fiel
我会写得非常简单,因为实际的修复并不比我不理解的实际设计重要。似乎一旦我的 @RequestBody 命中 @Controller,有关 subtype 的信息就会丢失。 假设我们有: class A
所以我正在做这个简单的动态编程问题,关于达到 n一次只能走 1 或 2 步。我知道答案基本上是一个斐波那契序列,答案是:达到n-2的步骤数+ 到达 n-1 的步数. T(n) = T(n-1) +
(function start (){ $('.bar').each(function(i){ var $bar = $(this); $(this).append('')
我有一个程序,我在启动它之前要求用户输入。 public static void main(String args[]) { String database = JOptionPane.sho
就是这样,我必须在提交按钮上有一张图片,但它根本没有出现。 我希望它看起来像这样: 现在看到我的是这样的,我不明白为什么它没有出现在页面上。 HTML CSS #sognu { bac
click here 点击后重定向至 xyz.com/#contact, 现在我想获得div #abc的顶部位置 //set the value as a variable, and remove t
here is a fiddle to know where I am starting from 我要解决的问题涉及对单个 html 文件的内容进行“分页”,以一种将它们一次锁定在一个部分中的方式。
是否可以在传递页面部分时运行 javascript 函数?我想要实现的是类似于 Twitter Bootstrap 的 scrollspy。 最佳答案 您可以使用 waypoints 插件: http
我有一个可以动态调整其大小的 iframe。我通过父页面上的发布消息和监听器解决了这个问题,因此每次 iframe 的内容发生变化时,iframe 的大小也会发生变化,并且永远不会有滚动条。 在 if
我试图让我的导航栏在到达我在网站下方设置的 anchor 时变得透明。 这是我的HTML Home About Logo W
我写了一个简单的程序来管理姓名列表(下面是程序的一部分)。我希望函数“choice()”结束并返回到 main()——从而结束程序——当用户对变量“option”的输入为 4 时。然而,choice(
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
代码片段在 while 循环后有一个 EOF,之后必须再次重新打开文件 - fopen 被重用。我的问题是是否有办法避免这种笨拙的 fopen 双重使用或以某种方式不使用 EOF? if (!(f=f
从这个页面: http://www.beta.inegi.org.mx/app/buscador/default.html?q=e15a61a 我正在尝试检索此网址: http://www.beta.
我使用维基百科的 API 来获取有关页面的信息。API 给我这样的 JSON: "query":{ "pages":{ "188791":{ "pageid":18879
我是一名优秀的程序员,十分优秀!