Android当中可以用request和response吗?
以下是一个登录界面的提交按钮操作,运行结果没有提示错误,但是运行结果什么都没有,是不是Android当中不可以用request和response?
mButton2.setOnClickListener(new Button.OnClickListener()
{
@Override
public void onClick(View v)
{
String id = mEditText1.getText().toString();
String pwdFld = mEditText2.getText().toString();
if (mEditText1.getText().length() == 0 || mEditText2.getText().length() == 0) {
toast();
mEditText1.setText(" ");
mEditText2.setText(" ");
}
/* //发送用户输入的用户名和密码给服务器
Request req = new Request();
req.setAction("userLogin");
req.setAttribute("id", id);
req.setAttribute("pwdFld", pwdFld);
System.out.println(id+ pwdFld);
//获取响应
Response response = null;
try {
response = ClientUtil.sendTextRequest(req);
} catch (IOException e1) {
e1.printStackTrace();
}
if(response.getStatus() == ResponseStatus.OK)
{
//获取当前用户
String newuser = response.getData("user");
System.out.println(newuser);
if(newuser!= null){ //登录成功
ClientDataBuffer.currentUser =newuser;
//跳入下一个Activity
//new UIChat(); //打开聊天窗体
}else{ //登录失败
String str = (String)response.getData("msg");
toast1(str);
//JOptionPane.showMessageDialog(UILogin.this, str,"登录失败",JOptionPane.ERROR_MESSAGE);
//new UILogin();
}
}else{
//JOptionPane.showMessageDialog(UILogin.this,
//"服务器内部错误,请稍后再试!!!","登录失败",JOptionPane.ERROR_MESSAGE);
}*/