Android WebService(基于SOAP协议)

package com.nenglong.wsclient;  
  
import java.io.IOException;  
  
import org.ksoap2.SoapEnvelope;  
import org.ksoap2.serialization.SoapObject;  
import org.ksoap2.serialization.SoapSerializationEnvelope;  
import org.ksoap2.transport.HttpTransportSE;  
import org.xmlpull.v1.XmlPullParserException;  
  
import android.os.Bundle;  
import android.os.Handler;  
import android.os.Looper;  
import android.os.Message;  
import android.os.StrictMode;  
import android.app.Activity;  
import android.view.Menu;  
import android.view.View;  
import android.view.View.OnClickListener;  
import android.widget.Button;  
import android.widget.EditText;  
import android.widget.TextView;  
  
/** 
 * @author huanglong Android 平台调用WebService(手机号码归属地查询) 
 */  
public class MainActivity extends Activity {  
private TextView tv_result;  
private EditText et_phone;  
private Button btn_query;  
  
@Override  
public void onCreate(Bundle savedInstanceState) {  
super.onCreate(savedInstanceState);  
setContentView(R.layout.activity_main);  
initView();  
}  
  
private void initView() {  
tv_result = (TextView) findViewById(R.id.result_text);  
et_phone = (EditText) findViewById(R.id.et);  
btn_query = (Button) findViewById(R.id.btn_query);  
btn_query.setOnClickListener(new OnClickListener() {  
  
@Override  
public void onClick(View v) {  
// TODO Auto-generated method stub  
String phone = et_phone.getText().toString().trim();  
if ("".equals(phone) || phone.length() < 7) {  
et_phone.setText("您输入的手机号码有误");  
et_phone.requestFocus();  
tv_result.setText("");  
return;  
}  
getRemoteInfo(phone);  
}  
});  
}  
  
/** 
 * 查询号码段归属地的方法 
 *  
 * @param phone 
 *手机号码段 
 */  
public void getRemoteInfo(final String phone) {  
new Thread(new Runnable() {  
  
@Override  
public void run() {  
// TODO Auto-generated method stub  
// 命名空间  
String nameSpace = "http://WebXml.com.cn/";  
// 调用方法的名称  
String methodName = "getMobileCodeInfo";  
// EndPoint  
String endPoint = "http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx";  
// SOAP Action  
String soapAction = "http://WebXml.com.cn/getMobileCodeInfo";  
// 指定WebService的命名空间和调用方法  
SoapObject soapObject = new SoapObject(nameSpace, methodName);  
// 设置需要调用WebService接口的两个参数mobileCode UserId  
soapObject.addProperty("mobileCode", phone);  
soapObject.addProperty("userId", "");  
// 生成调用WebService方法调用的soap信息,并且指定Soap版本  
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(  
SoapEnvelope.VER10);  
envelope.bodyOut = soapObject;  
// 是否调用DotNet开发的WebService  
envelope.dotNet = true;  
envelope.setOutputSoapObject(soapObject);  
HttpTransportSE transport = new HttpTransportSE(endPoint);  
try {  
transport.call(soapAction, envelope);  
} catch (IOException e) {  
// TODO Auto-generated catch block  
e.printStackTrace();  
} catch (XmlPullParserException e) {  
// TODO Auto-generated catch block  
e.printStackTrace();  
}  
// 获取返回的数据  
SoapObject object = (SoapObject) envelope.bodyIn;  
// 获取返回的结果  
String result = object.getProperty(0).toString();  
Message message = handler.obtainMessage();  
message.obj = result;  
handler.sendMessage(message);  
}  
}).start();  
}  
private Handler handler = new Handler(){  
public void handleMessage(android.os.Message msg) {  
// 将WebService得到的结果返回给TextView  
tv_result.setText(msg.obj.toString());  
};  
};  
}  

webService:基于SOAP协议的远程调用标准,通过webService可以将不用的操作系统平台,不同的计算机语言,不同的技术整合到一起。
调用webService需要导入jar包:ksoap2-android-assembly-2.5.2-jar-with-dependencies.jar包,这个包在网上可以下载,至于导入的方法 ,右键项目,选择最后一项properties-->Java build path-->Libraies-->Add external Jars 选择相应的路径下的jar文件就OK了,然后记得在Order and Export 里面将选择的jar文件勾选上。
调用webService的步骤分为7个:

  1. 实例化soapObject对象,指定Soap的命名空间(从相关文档中可以查看WSDL命名空间以及调用方法)
View Code   
  
//命名空间  
private static final String serviceNameSpace="http://WebXml.com.cn/";  
//调用方法(获得支持的城市)  
private static final String getSupportCity="getSupportCity";  
  
//实例化SoapObject对象  
SoapObject request=new SoapObject(serviceNameSpace, getSupportCity);  

2.假设方法有参数的话,添加调用的方法的参数

//获得序列化的Envelope  
SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);  
envelope.bodyOut=request;  

request.addProperties("参数名称","参数值");
3.设置SOAP请求信息(参数部分为SOAP版本号,与自己要调用的SOAP版本必须一致,也就是你导入到工程中的jar相对应的版本)

//获得序列化的Envelope  
SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);  
envelope.bodyOut=request;  

4.注册Enelope
(new MarshalBase64()).register(envelope);
5.构建传输对象,并指定WDSL文档中的URL

//请求URL  
private static final String serviceURL="http://www.webxml.com.cn/webservices/weatherwebservice.asmx";  
//Android传输对象  
AndroidHttpTransport transport=new AndroidHttpTransport(serviceURL);  
transport.debug=true;  

6.调用webService(其中参数为1:命名空间+方法名称,envelope对象);

transport.call(serviceNameSpace+getWeatherbyCityName, envelope);  

7.解析返回数据:

if(envelope.getResponse()!=null){  
return parse(envelope.bodyIn.toString());  
}  
  
/************** 
 * 解析XML 
 * @param str 
 * @return 
 */  
private static List<String> parse(String str){  
String temp;  
List<String> list=new ArrayList<String>();  
if(str!=null && str.length()>0){  
int start=str.indexOf("string");  
int end=str.lastIndexOf(";");  
temp=str.substring(start, end-3);  
String []test=temp.split(";");  
  
 for(int i=0;i<test.length;i++){  
 if(i==0){  
 temp=test[i].substring(7);  
 }else{  
 temp=test[i].substring(8);  
 }  
 int index=temp.indexOf(",");  
 list.add(temp.substring(0, index));  
 }  
}  
return list;  
}  

这样就成功了,这里有个地址是提供Webservice天气预报服务的,我们这里只提供了获取城市列表:

//命名空间  
private static final String serviceNameSpace="http://WebXml.com.cn/";  
//请求URL  
private static final String serviceURL="http://www.webxml.com.cn/webservices/weatherwebservice.asmx";  
//调用方法(获得支持的城市)  
private static final String getSupportCity="getSupportCity";  
//调用城市的方法(需要带参数)  
private static final String getWeatherbyCityName="getWeatherbyCityName";  
//调用省或者直辖市的方法(获得支持的省份或直辖市)  
private static final String getSupportProvince="getSupportProvince";  

在浏览器中输入WSDL serverUrl 就可以看到一些可供调用的方法:
我们选择国内外主要城市或者省份的调用方法:getSurpportPrivence(),然后调用之后你会发现返回给我们的是XML文档:

<?xml version="1.0" encoding="utf-8" ?>   
- <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://WebXml.com.cn/">  
  <string>直辖市</string>   
  <string>特别行政区</string>   
  <string>黑龙江</string>   
  <string>吉林</string>   
  <string>辽宁</string>   
  <string>内蒙古</string>   
  <string>河北</string>   
  <string>河南</string>   
  <string>山东</string>   
  <string>山西</string>   
  <string>江苏</string>   
  <string>安徽</string>   
  <string>陕西</string>   
  <string>宁夏</string>   
  <string>甘肃</string>   
  <string>青海</string>   
  <string>湖北</string>   
  <string>湖南</string>   
  <string>浙江</string>   
  <string>江西</string>   
  <string>福建</string>   
  <string>贵州</string>   
  <string>四川</string>   
  <string>广东</string>   
  <string>广西</string>   
  <string>云南</string>   
  <string>海南</string>   
  <string>新疆</string>   
  <string>西藏</string>   
  <string>台湾</string>   
  <string>亚洲</string>   
  <string>欧洲</string>   
  <string>非洲</string>   
  <string>北美洲</string>   
  <string>南美洲</string>   
  <string>大洋洲</string>   
  </ArrayOfString>  

class:

public class WebServiceHelper {  
 
//WSDL文档中的命名空间  
private static final String targetNameSpace="http://WebXml.com.cn/";  
//WSDL文档中的URL  
private static final String WSDL="http://webservice.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl";  
 
//需要调用的方法名(获得本天气预报Web Services支持的洲、国内外省份和城市信息)  
private static final String getSupportProvince="getSupportProvince";  
//需要调用的方法名(获得本天气预报Web Services支持的城市信息,根据省份查询城市集合:带参数)  
private static final String getSupportCity="getSupportCity";  
//根据城市或地区名称查询获得未来三天内天气情况、现在的天气实况、天气和生活指数  
private static final String getWeatherbyCityName="getWeatherbyCityName";  
  
  
/******** 
 * 获得州,国内外省份和城市信息 
 * @return 
 */  
public  List<String> getProvince(){  
List<String> provinces=new ArrayList<String>();  
String str="";  
SoapObject soapObject=new SoapObject(targetNameSpace,getSupportProvince);  
//request.addProperty("参数", "参数值");调用的方法参数与参数值(根据具体需要可选可不选)  
  
SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);  
envelope.dotNet=true;  
envelope.setOutputSoapObject(soapObject);//envelope.bodyOut=request;  
  
  
AndroidHttpTransport httpTranstation=new AndroidHttpTransport(WSDL);  
//或者HttpTransportSE httpTranstation=new HttpTransportSE(WSDL);  
try {  
  
httpTranstation.call(targetNameSpace+getSupportProvince, envelope);  
SoapObject result=(SoapObject)envelope.getResponse();  
//下面对结果进行解析,结构类似json对象  
//str=(String) result.getProperty(6).toString();  
  
int count=result.getPropertyCount();  
for(int index=0;index<count;index++){  
provinces.add(result.getProperty(index).toString());  
}  
  
} catch (IOException e) {  
// TODO Auto-generated catch block  
e.printStackTrace();  
} catch (XmlPullParserException e) {  
// TODO Auto-generated catch block  
e.printStackTrace();  
}   
return provinces;  
}  
  
/********** 
 * 根据省份或者直辖市获取天气预报所支持的城市集合 
 * @param province 
 * @return 
 */  
public  List<String> getCitys(String province){  
List<String> citys=new ArrayList<String>();  
SoapObject soapObject=new SoapObject(targetNameSpace,getSupportCity);  
soapObject.addProperty("byProvinceName", province);  
SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);  
envelope.dotNet=true;  
envelope.setOutputSoapObject(soapObject);  
  
AndroidHttpTransport httpTransport=new AndroidHttpTransport(WSDL);  
try {  
httpTransport.call(targetNameSpace+getSupportCity, envelope);  
SoapObject result=(SoapObject)envelope.getResponse();  
int count=result.getPropertyCount();  
for(int index=0;index<count;index++){  
citys.add(result.getProperty(index).toString());  
}  
  
} catch (IOException e) {  
// TODO Auto-generated catch block  
e.printStackTrace();  
} catch (XmlPullParserException e) {  
// TODO Auto-generated catch block  
e.printStackTrace();  
}   
return citys;  
}  
  
/*************************** 
 * 根据城市信息获取天气预报信息 
 * @param city 
 * @return 
 ***************************/  
public  WeatherBean getWeatherByCity(String city){  
  
WeatherBean bean=new WeatherBean();  
  
SoapObject soapObject=new SoapObject(targetNameSpace,getWeatherbyCityName);  
soapObject.addProperty("theCityName",city);//调用的方法参数与参数值(根据具体需要可选可不选)  
  
SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);  
envelope.dotNet=true;  
envelope.setOutputSoapObject(soapObject);//envelope.bodyOut=request;  
  
  
AndroidHttpTransport httpTranstation=new AndroidHttpTransport(WSDL);  
//或者HttpTransportSE httpTranstation=new HttpTransportSE(WSDL);  
try {  
httpTranstation.call(targetNameSpace+getWeatherbyCityName, envelope);  
SoapObject result=(SoapObject)envelope.getResponse();  
//下面对结果进行解析,结构类似json对象  
bean=parserWeather(result);  
   
} catch (IOException e) {  
// TODO Auto-generated catch block  
e.printStackTrace();  
} catch (XmlPullParserException e) {  
// TODO Auto-generated catch block  
e.printStackTrace();  
}   
return bean;  
}  
  
/** 
 * 解析返回的结果 
 * @param soapObject 
 */  
protected   WeatherBean parserWeather(SoapObject soapObject){  
WeatherBean bean=new WeatherBean();  
  
List<Map<String,Object>> list=new ArrayList<Map<String,Object>>();  
  
  
Map<String,Object> map=new HashMap<String,Object>();  
  
//城市名  
bean.setCityName(soapObject.getProperty(1).toString());  
//城市简介  
bean.setCityDescription(soapObject.getProperty(soapObject.getPropertyCount()-1).toString());  
//天气实况+建议  
bean.setLiveWeather(soapObject.getProperty(10).toString()+"\n"+soapObject.getProperty(11).toString());  
  
//其他数据  
//日期,  
String date=soapObject.getProperty(6).toString();  
//---------------------------------------------------  
String weatherToday="今天:" + date.split(" ")[0];
weatherToday+="\n天气:"+ date.split(" ")[1];   
weatherToday+="\n气温:"+soapObject.getProperty(5).toString();  
weatherToday+="\n风力:"+soapObject.getProperty(7).toString();  
weatherToday+="\n";  
  
List<Integer> icons=new ArrayList<Integer>();  
  
icons.add(parseIcon(soapObject.getProperty(8).toString()));
icons.add(parseIcon(soapObject.getProperty(9).toString()));  
   
map.put("weatherDay", weatherToday);  
map.put("icons",icons);  
list.add(map);  
  
  
  
  
//-------------------------------------------------  
map=new HashMap<String,Object>();   
date=soapObject.getProperty(13).toString();  
String weatherTomorrow="明天:" + date.split(" ")[0];
weatherTomorrow+="\n天气:"+ date.split(" ")[1];   
weatherTomorrow+="\n气温:"+soapObject.getProperty(12).toString();  
weatherTomorrow+="\n风力:"+soapObject.getProperty(14).toString();  
weatherTomorrow+="\n";  
  
icons=new ArrayList<Integer>();  
   
icons.add(parseIcon(soapObject.getProperty(15).toString()));
icons.add(parseIcon(soapObject.getProperty(16).toString()));  
  
map.put("weatherDay", weatherTomorrow);  
map.put("icons",icons);  
list.add(map);  
//--------------------------------------------------------------  
map=new HashMap<String,Object>();   
  
date=soapObject.getProperty(18).toString();  
String weatherAfterTomorrow="后天:" + date.split(" ")[0];
weatherAfterTomorrow+="\n天气:"+ date.split(" ")[1];   
weatherAfterTomorrow+="\n气温:"+soapObject.getProperty(17).toString();  
weatherAfterTomorrow+="\n风力:"+soapObject.getProperty(19).toString();  
weatherAfterTomorrow+="\n";  
  
icons=new ArrayList<Integer>();  
icons.add(parseIcon(soapObject.getProperty(20).toString()));
icons.add(parseIcon(soapObject.getProperty(21).toString()));  
  
map.put("weatherDay", weatherAfterTomorrow);  
map.put("icons",icons);  
list.add(map);   
//--------------------------------------------------------------  
  
bean.setList(list);  
return bean;  
}  
  
 //解析图标字符串  
 private int parseIcon(String data){  
// 0.gif,返回名称0,  
 int resID=32;  
 String result=data.substring(0, data.length()-4).trim();  
  // String []icon=data.split(".");  
  // String result=icon[0].trim();  
  //   Log.e("this is the icon", result.trim());  

   if(!result.equals("nothing")){  
   resID=Integer.parseInt(result.trim());  
   }  
 return resID;  
 //return ("a_"+data).split(".")[0];   
 }   
}  

以及帮助类:

public class WebServiceUtil {  
 
//命名空间  
private static final String serviceNameSpace="http://WebXml.com.cn/";  
//请求URL  
private static final String serviceURL="http://www.webxml.com.cn/webservices/weatherwebservice.asmx";  
//调用方法(获得支持的城市)  
private static final String getSupportCity="getSupportCity";  
//调用城市的方法(需要带参数)  
private static final String getWeatherbyCityName="getWeatherbyCityName";  
//调用省或者直辖市的方法(获得支持的省份或直辖市)  
private static final String getSupportProvince="getSupportProvince";  
   
/************* 
 * @return城市列表 
 *************/  
public static List<String> getCityList(){  
//实例化SoapObject对象  
SoapObject request=new SoapObject(serviceNameSpace, getSupportCity);  
//获得序列化的Envelope  
SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);  
envelope.bodyOut=request;  
(new MarshalBase64()).register(envelope);  
//Android传输对象  
AndroidHttpTransport transport=new AndroidHttpTransport(serviceURL);  
transport.debug=true;  
  
//调用  
try {  
transport.call(serviceNameSpace+getWeatherbyCityName, envelope);  
if(envelope.getResponse()!=null){  
return parse(envelope.bodyIn.toString());  
}  
  
} catch (IOException e) {  
// TODO Auto-generated catch block  
e.printStackTrace();  
} catch (XmlPullParserException e) {  
// TODO Auto-generated catch block  
e.printStackTrace();  
}  
  
  
return null;  
}  
  
  
public static List<String> getProviceList(){  
//实例化SoapObject对象  
SoapObject request=new SoapObject(serviceNameSpace, getSupportProvince);  
//获得序列化的Envelope  
SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);  
envelope.bodyOut=request;  
(new MarshalBase64()).register(envelope);  
//Android传输对象  
AndroidHttpTransport transport=new AndroidHttpTransport(serviceURL);  
transport.debug=true;  
  
//调用  
try {  
transport.call(serviceNameSpace+getWeatherbyCityName, envelope);  
if(envelope.getResponse()!=null){  
return null;  
}  
  
} catch (IOException e) {  
// TODO Auto-generated catch block  
e.printStackTrace();  
} catch (XmlPullParserException e) {  
// TODO Auto-generated catch block  
e.printStackTrace();  
}  
  
  
return null;  
}   
  
/************* 
 * @param cityName 
 * @return 
 *************/  
public static String getWeather(String cityName){  
   
return "";  
}  
  
/************** 
 * 解析XML 
 * @param str 
 * @return 
 */  
private static List<String> parse(String str){  
String temp;  
List<String> list=new ArrayList<String>();  
if(str!=null && str.length()>0){  
int start=str.indexOf("string");  
int end=str.lastIndexOf(";");  
temp=str.substring(start, end-3);  
String []test=temp.split(";");  
  
 for(int i=0;i<test.length;i++){  
 if(i==0){  
 temp=test[i].substring(7);  
 }else{  
 temp=test[i].substring(8);  
 }  
 int index=temp.indexOf(",");  
 list.add(temp.substring(0, index));  
 }  
}  
return list;  
}  
  
 /********* 
  * 获取天气 
  * @param soapObject 
  */  
 private void parseWeather(SoapObject soapObject){  
 //String date=soapObject.getProperty(6);  
 }   
}  

以上就是显示天气预报的全部代码
转载自:http://www.cnblogs.com/zhangdongzi/archive/2011/04/19/2020688.html
还可以调用免费的WebService显示手机号码的归属地,但是每天免费的次数是有限的,同样是调用WebService
但是调用WebService的时候,因为是网络操作,在Android 4.0.3以上的版本貌似会出现异常,后经过google发现是在
新版的Android系统里面,因为对网络的访问限制的更加严格,所以会报NetWorkOnMainThreadException 说的是对
于网络的访问不能放在主线程,这样的解决方案有两种,一种是开辟新的现成访问网络,call webService放在子线程中运行
还有一个解决方案是使用StricMode进行优化,strictMode有很多不同的策略进行优化,当开发者违背某个规则的时候,每个策略都
有不用的方法去提示用户。
显示号码归属地的代码:

package com.nenglong.wsclient;

import java.io.IOException;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.StrictMode;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

/**
 * @author huanglong Android 平台调用WebService(手机号码归属地查询)
 */
public class MainActivity extends Activity {
    private TextView tv_result;
    private EditText et_phone;
    private Button btn_query;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
    }

    private void initView() {
        tv_result = (TextView) findViewById(R.id.result_text);
        et_phone = (EditText) findViewById(R.id.et);
        btn_query = (Button) findViewById(R.id.btn_query);
        btn_query.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                String phone = et_phone.getText().toString().trim();
                if ("".equals(phone) || phone.length() < 7) {
                    et_phone.setText("您输入的手机号码有误");
                    et_phone.requestFocus();
                    tv_result.setText("");
                    return;
                }
                getRemoteInfo(phone);
            }
        });
    }

    /**
     * 查询号码段归属地的方法
     * 
     * @param phone
     *手机号码段
     */
    public void getRemoteInfo(final String phone) {
        new Thread(new Runnable() {
            
            @Override
            public void run() {
                // TODO Auto-generated method stub
                // 命名空间
                String nameSpace = "http://WebXml.com.cn/";
                // 调用方法的名称
                String methodName = "getMobileCodeInfo";
                // EndPoint
                String endPoint = "http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx";
                // SOAP Action
                String soapAction = "http://WebXml.com.cn/getMobileCodeInfo";
                // 指定WebService的命名空间和调用方法
                SoapObject soapObject = new SoapObject(nameSpace, methodName);
                // 设置需要调用WebService接口的两个参数mobileCode UserId
                soapObject.addProperty("mobileCode", phone);
                soapObject.addProperty("userId", "");
                // 生成调用WebService方法调用的soap信息,并且指定Soap版本
                SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                        SoapEnvelope.VER10);
                envelope.bodyOut = soapObject;
                // 是否调用DotNet开发的WebService
                envelope.dotNet = true;
                envelope.setOutputSoapObject(soapObject);
                HttpTransportSE transport = new HttpTransportSE(endPoint);
                try {
                    transport.call(soapAction, envelope);
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (XmlPullParserException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                // 获取返回的数据
                SoapObject object = (SoapObject) envelope.bodyIn;
                // 获取返回的结果
                String result = object.getProperty(0).toString();
                Message message = handler.obtainMessage();
                message.obj = result;
                handler.sendMessage(message);
            }
        }).start();
    }
    private Handler handler = new Handler(){
        public void handleMessage(android.os.Message msg) {
            // 将WebService得到的结果返回给TextView
            tv_result.setText(msg.obj.toString());
        };
    };
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 219,490评论 6 508
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,581评论 3 395
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 165,830评论 0 356
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,957评论 1 295
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,974评论 6 393
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,754评论 1 307
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,464评论 3 420
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,357评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,847评论 1 317
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,995评论 3 338
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,137评论 1 351
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,819评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,482评论 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 32,023评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,149评论 1 272
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,409评论 3 373
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 45,086评论 2 355

推荐阅读更多精彩内容

  • 一、Java基础 1.写出下面代码的执行结果 2.写出下面代码的执行结果 3.写出下面代码的执行结果 (此题需写出...
    joshul阅读 515评论 0 1
  • Web Services(Web服务)是一个用于支持网络间不同机器互操作的软件系统,它是一种自包含、自描述和模块化...
    哇楼主阅读 876评论 0 7
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,672评论 18 139
  • 工作中经常会遇到需要读取远程服务器的数据,目前流行的是有两种方法: 1.通过json数组形式返回给客户端 2.服务...
    窗外花絮阅读 1,888评论 0 49
  • 文/程序员男神 前言 最近接手新的任务,开发公司的移动新产品,想到自己一个人开发,蛋感觉瞬间很疼啊!接手到项目才发...
    程序猿男神阅读 4,304评论 1 11