Earthquake Project Address: http://blog.csdn.net/caroline_wendy/article/details/21976997
Because, the subscription source address (FEED): Http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.atom data is updated;
So when you read the title tag for the feed, a bug appears, such as title: <title>m 5.9-south of the Fiji islands</title>
Data:
<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" 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= "Magnit" Ude 5 "/> </entry>
The title of this data does not contain the final state, so the comma (",") is omitted, resulting in the Earthquakelistfragment.java class:
Details = Details.split (",") [1].trim ();
When splitting (split), no comma (",") is found, then contains only one string, using index 1 o'clock, an array is out of bounds,
Error: "Java.lang.arrayindexoutofboundsexception:length=1; Index=1 "
Change to, change the comma (",") to a minus sign ("-"):
Details = Details.split ("-") [1].trim ();
That is, location information contains "region, country".
Author: csdn Blog spike_king
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/