集成bmob云进行查询时出的问题

qq_33498638 2016-11-01 05:57:17
为什么每次都需要点击两次才能查询成功,System输出的结果是第一次点击的时候不会先执行输出111111的那个,然后才会去执行输出00000的,求解释

按钮监听事件
LoginIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

myPhone = username.getText().toString();
pwd = password.getText().toString();

queryObjects();


System.out.println("111111111111111" + myPhone2);

Toast.makeText(getApplicationContext(), myPhone2, Toast.LENGTH_LONG).show();


if (myPhone.equals(myPhone2)) {

if (pwd.equals(pwd2)) {
isLogin = true;
tos.setText("登录成功");
Intent intent = new Intent(LoginActivity.this, InfoActivity.class);
startActivity(intent);
} else {
tos.setText("密码错误");

}
} else {
// Toast.makeText(getApplicationContext(), myPhone2, Toast.LENGTH_LONG).show();
tos.setText("账号错误");
}
}


});

public void queryObjects() {


BmobQuery<UserBean> query = new BmobQuery<UserBean>();

query.addWhereEqualTo("phone", myPhone);
query.setLimit(1);
query.findObjects(new FindListener<UserBean>() {
@Override
public void done(List<UserBean> list, BmobException e) {
if (e == null) {
for (UserBean userBean : list) {
myPhone2 = userBean.getPhone();
pwd2 = userBean.getPassword();

}
// mmm.setText(myPhone2);
// Toast.makeText(getApplicationContext(),myPhone2,Toast.LENGTH_LONG).show();
} else {
Log.i("bmob", "失败:" + e.getMessage() + "," + e.getErrorCode());

}
isGet= true;
System.out.println("000000000000"+myPhone2);
}
});

}



}
...全文
126 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_33498638 2016-11-01
  • 打赏
  • 举报
回复
为什么不是先把数据从bmob云查询出来,然后判断对错,求大神讲解

80,362

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧