标签:
本文地址: http://blog.csdn.net/caroline_wendy/article/details/24465487
Earthquake项目地址: http://blog.csdn.net/caroline_wendy/article/details/21976997
因为, 订阅源地址(feed): http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.atom的数据发生更新;
所以读取订阅源的title标签时, 会出现bug, 如title: <title>M 5.9 - South of the Fiji Islands</title>
数据:
<entry> <id>urn:earthquake-usgs-gov:us:b000py4w</id> <title>M 5.9 - South of the Fiji Islands</title> <updated>2014-04-25T03:54:35.052Z</updated> <link rel="alternate" type="text/html" href="http://earthquake.usgs.gov/earthquakes/eventpage/usb000py4w"/> <link rel="alternate" type="application/cap+xml" href="http://earthquake.usgs.gov/earthquakes/eventpage/usb000py4w.cap"/> <summary type="html"> <![CDATA[ <p class="quicksummary"><a href="http://earthquake.usgs.gov/earthquakes/eventpage/usb000py4w#pager" title="PAGER estimated impact alert level" class="pager-green">PAGER - <strong class="roman">GREEN</strong></a> <a href="http://earthquake.usgs.gov/earthquakes/eventpage/usb000py4w#shakemap" title="ShakeMap maximum estimated intensity" class="mmi-III">ShakeMap - <strong class="roman">III</strong></a></p><dl><dt>Time</dt><dd>2014-04-24 19:51:58 UTC</dd><dd>2014-04-24 07:51:58 -12:00 at epicenter</dd><dt>Location</dt><dd>23.991°S 176.699°W</dd><dt>Depth</dt><dd>63.53 km (39.48 mi)</dd></dl> ]]> </summary> <georss:point>-23.9906 -176.6986</georss:point> <georss:elev>-63530</georss:elev> <category label="Age" term="Past Day"/> <category label="Magnitude" term="Magnitude 5"/> </entry>
details = details.split(",")[1].trim();在切分(split)时, 没有发现逗号(","), 则仅仅包括一个String, 使用索引(index)1时, 发生数组越界,
报错: "java.lang.ArrayIndexOutOfBoundsException: length=1; index=1"
改动为, 把逗号(",")改为减号("-"):
details = details.split("-")[1].trim();
版权声明:本文博主原创文章,博客,未经同意不得转载。
Android - Earthquake工程(地震监测) 的 对
标签:
原文地址:http://www.cnblogs.com/gcczhongduan/p/4803110.html