标签:src rem tle tno 不同 style back 技术 资源
//在主线程中定义一个Handler
private Handler handler=new Handler(){
//这个方法是在主线程中执行的
@Override
public void handleMessage(Message msg) {
tv_result.setText(msg.obj.toString());
}
};
Message msg=new Message();
msg.obj=content;
handler.sendMessage(msg);//发消息
Message msg=new Message();
msg.what=REQUESTEXCEPTION;
handler.sendMessage(msg);
@Override
public void handleMessage(Message msg) {
switch (msg.what){
case REQUESTSUCCESS: //请求成功
tv_result.setText(msg.obj.toString());
break;
case REQUESTNOTFIND: //目标资源不存在
Toast.makeText(MainActivity.this, "目标资源不存在", Toast.LENGTH_SHORT).show();
break;
case REQUESTEXCEPTION: //异常
Toast.makeText(MainActivity.this, "服务器忙 请稍等。。。", Toast.LENGTH_SHORT).show();
}
}
标签:src rem tle tno 不同 style back 技术 资源
原文地址:http://www.cnblogs.com/-Tiger/p/7149241.html