Android开发之使用Web Service进行网络编程

最后更新于:2022-04-01 09:32:07

## 使用Web Service进行网络编程 Android应用通常都是运行在手机平台上,手机系统的硬件资源是有限的,不管是存储能力还是计算能力都有限,在Android系统上开发、运行一些单用户、小型应用是可能的, 但对于需要进行大量的数据处理、复杂计算的应用,还是只能部署在远程服务器上,Android应用将只是充当这些应用的客户端。 为了让Android应用与远程服务器之间进行交互,可以借助子Java的RMI技术,但这要求远程服务器程序必须采用Java实现;也可以借助于CORBA技术,但这种技术显得过于复杂,除此之外,Web Service是一种不错的选择。 ## 1.Web Service 平台概述 Web Service平台主要涉及的技术有SOAP(Simple Object Access Protocol,简单对象访问协议),WSDL( Web Service Description Language,Web Service描述语言),UDDI(UniversalDescription, Description and Integration,统一描述、发现和整合协议)。 ### 1.1. SOAP (简单对象访问协议) SOAP (SimpleObject Access Protocol,简单对象访问协议)是一种具有扩展性的;XML消息协议。SOAP允许一个应用程序向另一个应用程序发送XML消息,SOAP消息是从SOAP发送者传至SOAP接收者的单路消息,任何应用程序均可作为发送者或接收者。SOAP仅定义消息结构和消息处理的协议,与底层的传输协议独立。因此,SOAP协议能通过HTTP, JMS 或SMTP协议传输。 SOAP依赖于XML文档来构建,一条SOAP消息就是一份特定的XML文档,SOAP消息包合如下三个主要元素: Ø必需的<Envelope.../>根元素,SOAP消息对应的XML文档以该元素作为根元素。 Ø可选的<Header../>元素,包含SOAP消息的头信息。 Ø必需的<Body../>元素,包含所有的调用和响应信息。 就目前的SOAP消息的结构来看,<Envelope.../>根元素的通常只能包含两个子元素,第一个子元素是可选的<Header../>元素,第二个子元素是必需的<Body../>元素。 ### 1.2. WSDL(WebService描述语言) WSDL (WebService Description Language, Web Service描述语言)使用 XML描述Web Service,包括访问和使用WebService所必需的信息,定义该Web Service的位置、功能及如何通信等描述信息。 一般来说,只要调用者能够获取WebService对应的WSDL,就可以从中了解它所提供的服务及如何调用Web Service。因为一份WSDL文件淸晰地定义了三个方面的内容。 ØWHAT部分:用于定义Web Service所提供的操作(或方法),也就是Web Service能做些什么。由WSDL中的<types. ../>、<message…/>、和<portTyp…/>元素定义。 ØHOW部分:用于定义如何访问Web Service,包括数据格式详情和访问Web Service操作的必要协议。也就是定义了如何访问Web Service。 ØWHERE部分:用于定义Web Service位于何处,如何使用特定协议决定的网络地址(如URL)指定。该部分使用<service.../>元素定义,可在WSDL文件的最后部分看到<service.../>元素。 一份WSDL文档通常可分为两个部分: Ø第一个部分定义了服务接口,它在WSDL中由<message.../>元素和<portType…/>两个元素组成,其中<message.../>元素定义了操作的交互方式。而<portType…/>元素里则可包含任意数量的<operation.../>元素,每个<operation.../>元素代表一个允许远程调用的操作(即方法)。 ØWSDL的第二个部分定义了服务实现,它在WSDL中由<binding.../>元素和 <service.../>两个元素组成,其中<binding.../>定义使用特定的通信协议、数据编码模型和底层通信协议,将Web Service服务接口定义映射到具体实现。而 <service.../>元素则包含一系列的<portType…/>子元素,< portType.../>子元素将会把绑定机制、服务访问协议和端点地址结合在一起。 ### 1.3. UDDI(统一描述、发现和整合协议) UDDI (UniversalDescription, Description and Integration,统一描述、发现和整合协议)是一套信息注册规范,它具有如下特点: Ø基于Web。 Ø分布式。 UDDI包括一组允许企业向外注册WebService、以使其他企业发现访问的实现标准。 UDDI的核心组件是UDDI注册中心,它使用XML文件来描述企业及其提供的Web Service, 通过使用UDDI, Web Service提供者可以对外注册Web Service,从而允许其他企业来调用该企业注册的Web Service。Web Service提供者通过UDDI注册中心的Web界面,将它所供的Web Service的信息加入UDDI注册中心,该Web Service就可以被发现和调用。 Web Service使用者也通过UDDI注册中心査找、发现自己所需的服务。当Web Service使用者找到自己所需的服务之后,可以将自己绑定到指定的Web Service提供者,再根据该 Web Service对应的WSDL文档来调用对方的服务。 ## 2. 使用Android启用调用Web Service Java本身提供了丰富的WebService支持,比如Sun公司制定的JAX-WS 2规范,还有 Apache开源组织所提供的Axis1、Axis2、CXF等,这些技术不仅可以用于非常方便地对外提供Web Service,也可以用于简化Web Service的客户端编程。 对于手机等小型设备而言,它们的计算资源、存储资源都十分有限,因此Android应用不大可能需要对外提供Web Service,Android应用通常只是充当Web Service的客户端,调用远程Web Serice。 Google为Android平台开发WebService客户端提供了 ksoap2-android项目,但这个项目并未直接集成在Android平台中,还需要开发人员自行下载。 ### 2.1为Android应用增加ksoap2-android支持的下步骤。 1)登录http://code.google.eom/p/ksoap2-android/站点,该站站点有介绍下载ksoap2-androi项目的方法。 2)下载 ksoap2-android项目的ksoap2-android-assembly-3.0.0-RC4.jar-with-dependencies. jar包。 3)将下载的jar包放到android项目的libs目录下即可。 为Android项目添加了ksoap2-android包之后,接下来借助   ksoap2-android项目来调用WebService所暴露出来的操作。 ### 2.2使用ksoap2-android调用Web Service操作的步驟如下: 1)创建HttpTransportSE对象,该对象用于调用WebService操作。 2)创建 SoapSerializationEnvelope对象。 提示:从名称来看SoapSerializationEnvelope代表一个SOAP消息封包;但ksoap2-android项目对 SoapSerializationEnvelope的处理比较特殊,它是HttpTransportSE调用WebService时信息的载体;客户端需要传入的参数,需要通过SoapSerializationEnvelope对象的bodyOut属性传给服务器;服务器响应生成的SOAP消息也通过该对象的body  Out属性来获取。 3)创建SoapObject对象,创建该对象时需要传入所要调用WebService的命名空间、Web Service方法名。 4)如果有参数需要传给Web Service服务器端,调用SoapObject对象的addProperty(Stringname,Object value)方法来设置参数,该方法的name参数指定参数名;value参数指定参数值。 5)调用SoapSerializationEnvelope的setOutputSoapObject()方法,或者直接对bodyOut属性赋值,将前两步创逆的SoapObject对象设为SoapSerializationEnvelope的传出SOAP消息体。 6)调用对象的call()方法,并以SoapSerializationEnvelope作为参数调用远程WebService。 7)调用完成后,访问SoapSerializationEnvelope对象的bodyln属性,该属性返回一个SoapObject对象,该对象就代表了Web Service的返回消息。解析该SoapObject对象,即可获取调用Web Service的返回值。 ### 2.3实例:调用Web Service实现天气预报 在开发天气预报的Android应用之前,首先需要找到一个可以对外提供天气预报的Web Service,通过搜索,发现http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx站点可以对外提供天气预报的WebService,因此程序将会调用该站点的Web Service来实现天气预报。 为了让应用界面更加美观,可以访问http://www.webxml.com.cn/images/weather.zip下载各种天气图标,可以使用这些天气图标来美化应用。 本程序主要需要调用如下三个Web Seivice操作: 获取省份。 根据省份获取城市。 根据城市获取天气。 为了调用上面的三个WebService应用程序提供如下工具类。 <table class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse; border:none"><tbody><tr style=""><td width="568" valign="top" style="width:426.1pt; border:solid green 1.0pt; padding:0cm 5.4pt 0cm 5.4pt"><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">public</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">class</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> WebServiceUtil</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black">{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">定义<span lang="EN-US">Web Service</span>的命名空间</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">static</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">final</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> String</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">SERVICE_NS</span></em><span lang="EN-US" style="font-family:宋体; color:black"> =</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"http://WebXml.com.cn/"</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">定义<span lang="EN-US">Web Service</span>提供服务的<span lang="EN-US">URL</span></span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">static</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">final</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> String</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">SERVICE_URL</span></em><span lang="EN-US" style="font-family:宋体; color:black"> =</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx"</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"> </span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">调用远程<span lang="EN-US">Web Service</span>获取省份列表</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">public</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">static</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> List&lt;String&gt; getProvinceList()</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">调用的方法</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">final</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> String methodName =</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"getRegionProvince"</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">创建<span lang="EN-US">HttpTransportSE</span>传输对象</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">final</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> HttpTransportSE ht =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> HttpTransportSE(</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">SERVICE_URL</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>ht.</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">debug</span><span lang="EN-US" style="font-family:宋体; color:black"> =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">true</span></strong><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">使用<span lang="EN-US">SOAP1.1</span>协议创建<span lang="EN-US">Envelop</span>对象</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">final</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> SoapSerializationEnvelope envelope =</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> SoapSerializationEnvelope(SoapEnvelope.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">VER11</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">实例化<span lang="EN-US">SoapObject</span>对象</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>SoapObject soapObject =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> SoapObject(</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">SERVICE_NS</span></em><span lang="EN-US" style="font-family:宋体; color:black">, methodName);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>envelope.</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">bodyOut</span><span lang="EN-US" style="font-family:宋体; color:black"> = soapObject;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">设置与<span lang="EN-US">.Net</span>提供的<span lang="EN-US">Web Service</span>保持较好的兼容性</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>envelope.</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">dotNet</span><span lang="EN-US" style="font-family:宋体; color:black"> =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">true</span></strong><span lang="EN-US" style="font-family:宋体; color:black">;<span style="">   </span></span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>FutureTask&lt;List&lt;String&gt;&gt; task =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> FutureTask&lt;List&lt;String&gt;&gt;(</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> Callable&lt;List&lt;String&gt;&gt;()</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><span lang="EN-US" style="font-family:宋体; color:#646464">@Override</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">public</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> List&lt;String&gt; call()</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">throws</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> Exception</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">调用<span lang="EN-US">Web Service</span></span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span>ht.call(</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">SERVICE_NS</span></em><span lang="EN-US" style="font-family:宋体; color:black"> + methodName, envelope);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (envelope.getResponse() !=</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">null</span></strong><span lang="EN-US" style="font-family:宋体; color:black">)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">                   </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">获取服务器响应返回的<span lang="EN-US">SOAP</span>消息</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">                   </span>SoapObject result = (SoapObject) envelope.</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">bodyIn</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">                   </span>SoapObject detail = (SoapObject) result.getProperty(</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">                       </span>methodName +</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"Result"</span><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">                   </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">解析服务器响应的<span lang="EN-US">SOAP</span>消息。</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">                   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"><em>parseProvinceOrCity</em>(detail);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">null</span></strong><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>});</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> Thread(task).start();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">try</span></strong><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> task.get();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">catch</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (Exception e)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>e.printStackTrace();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">null</span></strong><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"> </span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">根据省份获取城市列表</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">public</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">static</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> List&lt;String&gt; getCityListByProvince(String province)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">调用的方法</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">final</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> String methodName =</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"getSupportCityString"</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">创建<span lang="EN-US">HttpTransportSE</span>传输对象</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">final</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> HttpTransportSE ht =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> HttpTransportSE(</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">SERVICE_URL</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>ht.</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">debug</span><span lang="EN-US" style="font-family:宋体; color:black"> =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">true</span></strong><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">实例化<span lang="EN-US">SoapObject</span>对象</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>SoapObject soapObject =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> SoapObject(</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">SERVICE_NS</span></em><span lang="EN-US" style="font-family:宋体; color:black">, methodName);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">添加一个请求参数</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>soapObject.addProperty(</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"theRegionCode"</span><span lang="EN-US" style="font-family:宋体; color:black">, province);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">使用<span lang="EN-US">SOAP1.1</span>协议创建<span lang="EN-US">Envelop</span>对象</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">final</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> SoapSerializationEnvelope envelope =</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> SoapSerializationEnvelope(SoapEnvelope.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">VER11</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>envelope.</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">bodyOut</span><span lang="EN-US" style="font-family:宋体; color:black"> = soapObject;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">设置与<span lang="EN-US">.Net</span>提供的<span lang="EN-US">Web Service</span>保持较好的兼容性</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>envelope.</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">dotNet</span><span lang="EN-US" style="font-family:宋体; color:black"> =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">true</span></strong><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>FutureTask&lt;List&lt;String&gt;&gt; task =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> FutureTask&lt;List&lt;String&gt;&gt;(</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> Callable&lt;List&lt;String&gt;&gt;()</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><span lang="EN-US" style="font-family:宋体; color:#646464">@Override</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">public</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> List&lt;String&gt; call()</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">throws</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> Exception</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">调用<span lang="EN-US">Web Service</span></span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span>ht.call(</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">SERVICE_NS</span></em><span lang="EN-US" style="font-family:宋体; color:black"> + methodName, envelope);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (envelope.getResponse() !=</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">null</span></strong><span lang="EN-US" style="font-family:宋体; color:black">)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">                   </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">获取服务器响应返回的<span lang="EN-US">SOAP</span>消息</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">                   </span>SoapObject result = (SoapObject) envelope.</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">bodyIn</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">                   </span>SoapObject detail = (SoapObject) result.getProperty(</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">                       </span>methodName +</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"Result"</span><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">                   </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">解析服务器响应的<span lang="EN-US">SOAP</span>消息。</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">                   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"><em>parseProvinceOrCity</em>(detail);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">null</span></strong><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>});</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> Thread(task).start();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">try</span></strong><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> task.get();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">catch</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (Exception e)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>e.printStackTrace();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">null</span></strong><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"> </span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">private</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">static</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> List&lt;String&gt; parseProvinceOrCity(SoapObject detail)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>ArrayList&lt;String&gt; result =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> ArrayList&lt;String&gt;();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">for</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">int</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> i = 0; i &lt; detail.getPropertyCount(); i++)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">解析出每个省份</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>result.add(detail.getProperty(i).toString().split(</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">","</span><span lang="EN-US" style="font-family:宋体; color:black">)[0]);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> result;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"> </span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">public</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">static</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> SoapObject getWeatherByCity(String cityName)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">final</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> String methodName =</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"getWeather"</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">final</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> HttpTransportSE ht =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> HttpTransportSE(</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">SERVICE_URL</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>ht.</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">debug</span><span lang="EN-US" style="font-family:宋体; color:black"> =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">true</span></strong><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">nbsp;      </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">final</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> SoapSerializationEnvelope envelope =</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> SoapSerializationEnvelope(SoapEnvelope.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">VER11</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>SoapObject soapObject =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> SoapObject(</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">SERVICE_NS</span></em><span lang="EN-US" style="font-family:宋体; color:black">, methodName);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>soapObject.addProperty(</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"theCityCode"</span><span lang="EN-US" style="font-family:宋体; color:black">, cityName);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>envelope.</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">bodyOut</span><span lang="EN-US" style="font-family:宋体; color:black"> = soapObject;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">设置与<span lang="EN-US">.Net</span>提供的<span lang="EN-US">Web Service</span>保持较好的兼容性</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>envelope.</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">dotNet</span><span lang="EN-US" style="font-family:宋体; color:black"> =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">true</span></strong><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>FutureTask&lt;SoapObject&gt; task =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> FutureTask&lt;SoapObject&gt;(</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> Callable&lt;SoapObject&gt;()</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><span lang="EN-US" style="font-family:宋体; color:#646464">@Override</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">public</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> SoapObject call()</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">throws</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> Exception</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span>ht.call(</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">SERVICE_NS</span></em><span lang="EN-US" style="font-family:宋体; color:black"> + methodName, envelope);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span>SoapObject result = (SoapObject) envelope.</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">bodyIn</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span>SoapObject detail = (SoapObject) result.getProperty(</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">                   </span>methodName +</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"Result"</span><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> detail;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>});</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> Thread(task).start();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">try</span></strong><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> task.get();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">catch</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (Exception e)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>e.printStackTrace();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">null</span></strong><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black">}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal"><span lang="EN-US"> </span></p></td></tr></tbody></table> 上面的程序调用Web Service的方法还是没有改变,前面两个方法——获取系统支持的省份列表,根据省份获取城市列表——将远程Web Service返回的数据解析成List<String>后返回,这样方便Android应用使用。由于第二个方法需要返回的数据量较多,所以程序直接返回了 SoapObject 对象。 上面的程序中调用WebService时将SoapSerializationEnvelope对象的dotNet属性设为 true——因为上面这个网站是通过.NET来对外提供WebService的,因此需要将 SoapSerializationEnvelope对象的 dotNet 属性设为 true。 有了上面的调用WebService的工具类之后,接下来可以在Activity中使用该工具类来获取天气服务信息。该Activity使用了两个Spinner让用户选择省份、城市,当用户选择指定城市后,系统将会加载该程序的天气信息。 该程序的界面布局代码如下: <table class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse; border:none"><tbody><tr style=""><td width="568" valign="top" style="width:426.1pt; border:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt"><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span class="GramE"><span lang="EN-US" style="font-family:宋体; color:teal">&lt;?</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">xml</span></span><span lang="EN-US" style="font-family:宋体"><span style="color:#7F007F">version</span><span style="color:black">=</span><em><span style="color:#2A00FF">"1.0"</span></em><span style="color:#7F007F">encoding</span><span style="color:black">=</span><em><span style="color:#2A00FF">"utf-8"</span></em><span style="color:teal">?&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">LinearLayout</span><span lang="EN-US" style="font-family:宋体"><span style="color:#7F007F">xmlns:android</span><span style="color:black">=</span><em><span style="color:#2A00FF">"http://schemas.android.com/apk/res/android"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">   </span><span style="color:#7F007F">android:orientation</span><span style="color:black">=</span><em><span style="color:#2A00FF">"vertical"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">   </span><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"fill_parent"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">   </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em><span style="color:teal">&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">LinearLayout</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">       </span><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"fill_parent"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">       </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">       </span><span style="color:#7F007F">android:orientation</span><span style="color:black">=</span><em><span style="color:#2A00FF">"horizontal"</span></em><span style="color:teal">&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">TextView</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:hint</span><span style="color:black">=</span><em><span style="color:#2A00FF">"@string/province"</span></em><span style="color:teal">/&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F5FBF">&lt;!--</span><span style="font-family:宋体; color:#3F5FBF">让用户选择省份的<span lang="EN-US">Spinner --&gt;</span></span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">Spinner</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:id</span><span style="color:black">=</span><em><span style="color:#2A00FF">"@+id/province"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em><span style="color:teal">/&gt;</span><span style="color:black"><span style=""> </span></span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">TextView</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">       </span><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">       </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">       </span><span style="color:#7F007F">android:hint</span><span style="color:black">=</span><em><span style="color:#2A00FF">"@string/city"</span></em><span style="color:teal">/&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F5FBF">&lt;!--</span><span style="font-family:宋体; color:#3F5FBF">让用户选择城市的<span lang="EN-US">Spinner --&gt;</span></span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">Spinner</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:id</span><span style="color:black">=</span><em><span style="color:#2A00FF">"@+id/city"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em><span style="color:teal">/&gt;</span><span style="color:black"><span style=""> </span></span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:teal">&lt;/</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">LinearLayout</span><span lang="EN-US" style="font-family:宋体; color:teal">&gt;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">TextView</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">   </span><span style="color:#7F007F">android:id</span><span style="color:black">=</span><em><span style="color:#2A00FF">"@+id/weatherCurrent"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">   </span><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"fill_parent"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">   </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em><span style="color:teal">/&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:#3F5FBF">&lt;!--</span><span style="font-family:宋体; color:#3F5FBF">显示今天天气的图片和文本框<span lang="EN-US"> --&gt;</span></span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">LinearLayout</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">       </span><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"fill_parent"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">       </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em><span style="color:teal">&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><u><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">ImageView</span></u><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:id</span><span style="color:black">=</span><em><span style="color:#2A00FF">"@+id/todayWhIcon1"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em><span style="color:teal">/&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><u><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">ImageView</span></u><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:id</span><span style="color:black">=</span><em><span style="color:#2A00FF">"@+id/todayWhIcon2"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em><span style="color:teal">/&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">TextView</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:id</span><span style="color:black">=</span><em><span style="color:#2A00FF">"@+id/weatherToday"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><u><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"fill_parent"</span></em></u></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_weight</span><span style="color:black">=</span><em><span style="color:#2A00FF">"1"</span></em><span style="color:teal">/&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:teal">&lt;/</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">LinearLayout</span><span lang="EN-US" style="font-family:宋体; color:teal">&gt;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:#3F5FBF">&lt;!--</span><span style="font-family:宋体; color:#3F5FBF">显示明天天气的图片和文本框<span lang="EN-US"> --&gt;</span></span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">LinearLayout</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">       </span><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"fill_parent"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">       </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em><span style="color:teal">&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><u><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">ImageView</span></u><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:id</span><span style="color:black">=</span><em><span style="color:#2A00FF">"@+id/tomorrowWhIcon1"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em><span style="color:teal">/&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><u><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">ImageView</span></u><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:id</span><span style="color:black">=</span><em><span style="color:#2A00FF">"@+id/tomorrowWhIcon2"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em><span style="color:teal">/&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">TextView</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:id</span><span style="color:black">=</span><em><span style="color:#2A00FF">"@+id/weatherTomorrow"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><u><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"fill_parent"</span></em></u></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_weight</span><span style="color:black">=</span><em><span style="color:#2A00FF">"1"</span></em><span style="color:teal">/&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:teal">&lt;/</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">LinearLayout</span><span lang="EN-US" style="font-family:宋体; color:teal">&gt;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:#3F5FBF">&lt;!--</span><span style="font-family:宋体; color:#3F5FBF">显示后天天气的图片和文本框<span lang="EN-US"> --&gt;</span></span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">LinearLayout</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">       </span><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"fill_parent"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">       </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em><span style="color:teal">&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><u><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">ImageView</span></u><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:id</span><span style="color:black">=</span><em><span style="color:#2A00FF">"@+id/afterdayWhIcon1"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em><span style="color:teal">/&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><u><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">ImageView</span></u><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:id</span><span style="color:black">=</span><em><span style="color:#2A00FF">"@+id/afterdayWhIcon2"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em><span style="color:teal">/&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:teal">&lt;</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">TextView</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:id</span><span style="color:black">=</span><em><span style="color:#2A00FF">"@+id/weatherAfterday"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><u><span style="color:#7F007F">android:layout_width</span><span style="color:black">=</span><em><span style="color:#2A00FF">"fill_parent"</span></em></u></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_height</span><span style="color:black">=</span><em><span style="color:#2A00FF">"wrap_content"</span></em></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"><span style="">           </span><span style="color:#7F007F">android:layout_weight</span><span style="color:black">=</span><em><span style="color:#2A00FF">"1"</span></em><span style="color:teal">/&gt;</span></span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:teal">&lt;/</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">LinearLayout</span><span lang="EN-US" style="font-family:宋体; color:teal">&gt;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"> </span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:teal">&lt;/</span><span lang="EN-US" style="font-family:宋体; color:#3F7F7F">LinearLayout</span><span lang="EN-US" style="font-family:宋体; color:teal">&gt;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal"><span lang="EN-US" style="font-family:宋体"> </span></p></td></tr></tbody></table> 当程序加载时,程序会调用WebServiceUtil的getProvinceList()方法来获取省份列表,并 使用第一个Spinner加载、显示所有省份:当用户改变选择了省份之后,程序会调用 WebServiceUtil的getCityListByProvince(Stringprovince)方法来获取该省份的全部城市:当用户改变选择城市之后,程序会调用WebServiceUtil的getWeatherByCity(StringcityName)方法 获取该城市的天气。 该Activity的代码如下: <table class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse; border:none"><tbody><tr style=""><td width="568" valign="top" style="width:426.1pt; border:solid windowtext 1.0pt; padding:0cm 5.4pt 0cm 5.4pt"><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">public</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">class</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> GetWeather</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">extends</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> Activity</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black">{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">private</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> Spinner</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">provinceSpinner</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">private</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> Spinner</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">citySpinner</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">private</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> ImageView</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">todayWhIcon1</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">private</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> ImageView</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">todayWhIcon2</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">private</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> TextView</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">textWeatherToday</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">private</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> ImageView</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">tomorrowWhIcon1</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">private</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> ImageView</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">tomorrowWhIcon2</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">private</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> TextView</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">textWeatherTomorrow</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">private</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> ImageView</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">afterdayWhIcon1</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">private</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> ImageView</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">afterdayWhIcon2</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">private</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> TextView</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">textWeatherAfterday</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">private</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> TextView</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">textWeatherCurrent</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"> </span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:#646464">@Override</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">public</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">void</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> onCreate(Bundle savedInstanceState)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">super</span></strong><span lang="EN-US" style="font-family:宋体; color:black">.onCreate(savedInstanceState);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>setContentView(R.layout.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">main</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"> </span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">todayWhIcon1</span><span lang="EN-US" style="font-family:宋体; color:black"> = (ImageView) findViewById(R.id.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">todayWhIcon1</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">todayWhIcon2</span><span lang="EN-US" style="font-family:宋体; color:black"> = (ImageView) findViewById(R.id.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">todayWhIcon2</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">textWeatherToday</span><span lang="EN-US" style="font-family:宋体; color:black"> = (TextView) findViewById(R.id.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">weatherToday</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">tomorrowWhIcon1</span><span lang="EN-US" style="font-family:宋体; color:black"> = (ImageView) findViewById(R.id.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">tomorrowWhIcon1</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">tomorrowWhIcon2</span><span lang="EN-US" style="font-family:宋体; color:black"> = (ImageView) findViewById(R.id.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">tomorrowWhIcon2</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">textWeatherTomorrow</span><span lang="EN-US" style="font-family:宋体; color:black"> = (TextView) findViewById(R.id.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">weatherTomorrow</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">afterdayWhIcon1</span><span lang="EN-US" style="font-family:宋体; color:black"> = (ImageView) findViewById(R.id.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">afterdayWhIcon1</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">afterdayWhIcon2</span><span lang="EN-US" style="font-family:宋体; color:black"> = (ImageView) findViewById(R.id.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">afterdayWhIcon2</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">textWeatherAfterday</span><span lang="EN-US" style="font-family:宋体; color:black"> = (TextView) findViewById(R.id.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">weatherAfterday</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">textWeatherCurrent</span><span lang="EN-US" style="font-family:宋体; color:black"> = (TextView) findViewById(R.id.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">weatherCurrent</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"> </span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">获取程序界面中选择省份、城市的<span lang="EN-US">Spinner</span>组件</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">provinceSpinner</span><span lang="EN-US" style="font-family:宋体; color:black"> = (Spinner) findViewById(R.id.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">province</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">citySpinner</span><span lang="EN-US" style="font-family:宋体; color:black"> = (Spinner) findViewById(R.id.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">city</span></em><span lang="EN-US" style="font-family:宋体; color:black">);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">调用远程<span lang="EN-US">Web Service</span>获取省份列表</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>List&lt;String&gt; provinces = WebServiceUtil.<em>getProvinceList</em>();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>ListAdapter adapter =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> ListAdapter(</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">this</span></strong><span lang="EN-US" style="font-family:宋体; color:black">, provinces);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">使用<span lang="EN-US">Spinner</span>显示省份列表</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">provinceSpinner</span><span lang="EN-US" style="font-family:宋体; color:black">.setAdapter(adapter);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">当省份<span lang="EN-US">Spinner</span>的选择项被改变时</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">provinceSpinner</span><span lang="EN-US" style="font-family:宋体; color:black">.setOnItemSelectedListener(</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> OnItemSelectedListener()</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><span lang="EN-US" style="font-family:宋体; color:#646464">@Override</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">public</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">void</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> onItemSelected(AdapterView&lt;?&gt; source, View parent,</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">int</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> position,</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">long</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> id)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span>List&lt;String&gt; cities = WebServiceUtil</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">                   </span>.<em>getCityListByProvince</em>(</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">provinceSpinner</span><span lang="EN-US" style="font-family:宋体; color:black">.getSelectedItem()</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">                       </span>.toString());</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span>ListAdapter cityAdapter =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> ListAdapter(GetWeather.</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">this</span></strong><span lang="EN-US" style="font-family:宋体; color:black">,</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">                   </span>cities);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">使用<span lang="EN-US">Spinner</span>显示城市列表</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">citySpinner</span><span lang="EN-US" style="font-family:宋体; color:black">.setAdapter(cityAdapter);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"> </span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><span lang="EN-US" style="font-family:宋体; color:#646464">@Override</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">public</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">void</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> onNothingSelected(AdapterView&lt;?&gt; arg0)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>});</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">当城市<span lang="EN-US">Spinner</span>的选择项被改变时</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">citySpinner</span><span lang="EN-US" style="font-family:宋体; color:black">.setOnItemSelectedListener(</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> OnItemSelectedListener()</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><span lang="EN-US" style="font-family:宋体; color:#646464">@Override</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">public</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">void</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> onItemSelected(AdapterView&lt;?&gt; source, View parent,</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">int</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> position,</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">long</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> id)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">               </span>showWeather(</span><span lang="EN-US" style="font-family:宋体; color:#0000C0">citySpinner</span><span lang="EN-US" style="font-family:宋体; color:black">.getSelectedItem().toString());</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"> </span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><span lang="EN-US" style="font-family:宋体; color:#646464">@Override</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">public</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">void</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> onNothingSelected(AdapterView&lt;?&gt; arg0)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>});</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"> </span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">private</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">void</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> showWeather(String city)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>String weatherToday =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">null</span></strong><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>String weatherTomorrow =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">null</span></strong><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>String weatherAfterday =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">null</span></strong><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>String weatherCurrent =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">null</span></strong><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">int</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> iconToday[] =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">int</span></strong><span lang="EN-US" style="font-family:宋体; color:black">[2];</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">int</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> iconTomorrow[] =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">int</span></strong><span lang="EN-US" style="font-family:宋体; color:black">[2];</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">int</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> iconAfterday[] =</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">new</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">int</span></strong><span lang="EN-US" style="font-family:宋体; color:black">[2];</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">获取远程<span lang="EN-US">Web Service</span>返回的对象</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>SoapObject detail = WebServiceUtil.<em>getWeatherByCity</em>(city);<span style="">     </span></span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">获取天气实况</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>weatherCurrent = detail.getProperty(4).toString();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">解析今天的天气情况</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>String date = detail.getProperty(7).toString();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>weatherToday =</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"</span><span style="font-family:宋体; color:#2A00FF">今天:<span lang="EN-US">"</span></span><span lang="EN-US" style="font-family:宋体; color:black"> + date.split(</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">" "</span><span lang="EN-US" style="font-family:宋体; color:black">)[0];</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>weatherToday = weatherToday +</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"\n</span><span style="font-family:宋体; color:#2A00FF">天气:<span lang="EN-US">"</span></span><span lang="EN-US" style="font-family:宋体; color:black"> + date.split(</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">" "</span><span lang="EN-US" style="font-family:宋体; color:black">)[1];</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>weatherToday = weatherToday +</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"\n</span><span style="font-family:宋体; color:#2A00FF">气温:<span lang="EN-US">"</span></span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>+ detail.getProperty(8).toString();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>weatherToday = weatherToday +</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"\n</span><span style="font-family:宋体; color:#2A00FF">风力:<span lang="EN-US">"</span></span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>+ detail.getProperty(9).toString() +</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"\n"</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>iconToday[0] = parseIcon(detail.getProperty(10).toString());</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>iconToday[1] = parseIcon(detail.getProperty(11).toString());</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">解析明天的天气情况</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>date = detail.getProperty(12).toString();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>weatherTomorrow =</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"</span><span style="font-family:宋体; color:#2A00FF">明天:<span lang="EN-US">"</span></span><span lang="EN-US" style="font-family:宋体; color:black"> + date.split(</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">" "</span><span lang="EN-US" style="font-family:宋体; color:black">)[0];</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>weatherTomorrow = weatherTomorrow +</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"\n</span><span style="font-family:宋体; color:#2A00FF">天气:<span lang="EN-US">"</span></span><span lang="EN-US" style="font-family:宋体; color:black"> + date.split(</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">" "</span><span lang="EN-US" style="font-family:宋体; color:black">)[1];</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>weatherTomorrow = weatherTomorrow +</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"\n</span><span style="font-family:宋体; color:#2A00FF">气温:<span lang="EN-US">"</span></span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>+ detail.getProperty(13).toString();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>weatherTomorrow = weatherTomorrow +</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"\n</span><span style="font-family:宋体; color:#2A00FF">风力:<span lang="EN-US">"</span></span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>+ detail.getProperty(14).toString() +</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"\n"</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>iconTomorrow[0] = parseIcon(detail.getProperty(15).toString());</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>iconTomorrow[1] = parseIcon(detail.getProperty(16).toString());</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">解析后天的天气情况</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>date = detail.getProperty(17).toString();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>weatherAfterday =</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"</span><span style="font-family:宋体; color:#2A00FF">后天:<span lang="EN-US">"</span></span><span lang="EN-US" style="font-family:宋体; color:black"> + date.split(</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">" "</span><span lang="EN-US" style="font-family:宋体; color:black">)[0];</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>weatherAfterday = weatherAfterday +</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"\n</span><span style="font-family:宋体; color:#2A00FF">天气:<span lang="EN-US">"</span></span><span lang="EN-US" style="font-family:宋体; color:black"> + date.split(</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">" "</span><span lang="EN-US" style="font-family:宋体; color:black">)[1];</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>weatherAfterday = weatherAfterday +</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"\n</span><span style="font-family:宋体; color:#2A00FF">气温:<span lang="EN-US">"</span></span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>+ detail.getProperty(18).toString();</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>weatherAfterday = weatherAfterday +</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"\n</span><span style="font-family:宋体; color:#2A00FF">风力:<span lang="EN-US">"</span></span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span>+ detail.getProperty(19).toString() +</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"\n"</span><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>iconAfterday[0] = parseIcon(detail.getProperty(20).toString());</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span>iconAfterday[1] = parseIcon(detail.getProperty(21).toString());</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">更新当天的天气实况</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">textWeatherCurrent</span><span lang="EN-US" style="font-family:宋体; color:black">.setText(weatherCurrent);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">更新显示今天天气的图标和文本框</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">textWeatherToday</span><span lang="EN-US" style="font-family:宋体; color:black">.setText(weatherToday);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">todayWhIcon1</span><span lang="EN-US" style="font-family:宋体; color:black">.setImageResource(iconToday[0]);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">todayWhIcon2</span><span lang="EN-US" style="font-family:宋体; color:black">.setImageResource(iconToday[1]);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">更新显示明天天气的图标和文本框</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">textWeatherTomorrow</span><span lang="EN-US" style="font-family:宋体; color:black">.setText(weatherTomorrow);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">tomorrowWhIcon1</span><span lang="EN-US" style="font-family:宋体; color:black">.setImageResource(iconTomorrow[0]);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">tomorrowWhIcon2</span><span lang="EN-US" style="font-family:宋体; color:black">.setImageResource(iconTomorrow[1]);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">更新显示后天天气的图标和文本框</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">textWeatherAfterday</span><span lang="EN-US" style="font-family:宋体; color:black">.setText(weatherAfterday);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">afterdayWhIcon1</span><span lang="EN-US" style="font-family:宋体; color:black">.setImageResource(iconAfterday[0]);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><span lang="EN-US" style="font-family:宋体; color:#0000C0">afterdayWhIcon2</span><span lang="EN-US" style="font-family:宋体; color:black">.setImageResource(iconAfterday[1]);</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体"> </span></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><span lang="EN-US" style="font-family:宋体; color:#3F7F5F">//</span><span style="font-family:宋体; color:#3F7F5F">工具方法,该方法负责把返回的天气图标字符串,转换为程序的图片资源<span lang="EN-US">ID</span>。</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">private</span></strong><span lang="EN-US" style="font-family:宋体; color:black"/><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">int</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> parseIcon(String strIcon)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span>{</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (strIcon ==</span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">null</span></strong><span lang="EN-US" style="font-family:宋体; color:black">)</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> -1;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"0.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_0</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"1.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_1</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"2.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_2</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"3.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_3</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"4.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_4</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"5.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_5</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"6.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_6</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"7.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_7</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"8.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_8</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"9.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_9</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"10.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_10</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"11.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_11</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"12.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_12</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"13.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_13</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"14.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_14</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"15.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_15</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"16.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_16</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"17.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_17</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"18.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_18</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"19.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_19</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"20.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span><span style="">   </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_20</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"21.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_21</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"22.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_22</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"23.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_23</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"24.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_24</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"25.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_25</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"26.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_26</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"27.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_27</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"28.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_28</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"29.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_29</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"30.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_30</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">if</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> (</span><span lang="EN-US" style="font-family:宋体; color:#2A00FF">"31.gif"</span><span lang="EN-US" style="font-family:宋体; color:black">.equals(strIcon))</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">           </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> R.drawable.</span><em><span lang="EN-US" style="font-family:宋体; color:#0000C0">a_31</span></em><span lang="EN-US" style="font-family:宋体; color:black">;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">       </span></span><strong><span lang="EN-US" style="font-family:宋体; color:#7F0055">return</span></strong><span lang="EN-US" style="font-family:宋体; color:black"> 0;</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal" align="left" style="text-align:left; text-autospace:none"><span lang="EN-US" style="font-family:宋体; color:black"><span style="">   </span>}</span><span lang="EN-US" style="font-family:宋体"/></p><p class="MsoNormal"><span lang="EN-US" style="font-family:宋体"> </span></p></td></tr></tbody></table> 上面的Activity代码己经不再涉及调用WebService的代码了,只是简单地调用Web Service操作,解析Web Service返回的SOAP消息包,并把SOAP消息包中的数据显示出来。 未完待续..........
';