集成bmob云进行查询时出的问题
为什么每次都需要点击两次才能查询成功,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);
}
});
}
}
按钮监听事件
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);
}
});
}
}
...全文
相关推荐
Bmob查询数据和显示数据
然后,在Android项目中集成Bmob SDK,通过Gradle添加依赖:```groovydependencies { implementation 'cn.bmob.v3:bmob-sdk:3.15.0
bmob云sdk3.5.9
【bmob云SDK3.5.9】是bmob公司提供的一个重要的开发工具,主要用于帮助开发者集成并利用bmob的后端云服务来构建具备聊天功能的通讯工具。
bmob上传图片的小demo
Bmob是一家提供云端数据存储和管理服务的公司,特别适合移动应用开发者,它允许开发者轻松地在应用程序中实现数据的存储、查询和同步功能,而无需自己搭建服务器。
Android通过Bmob实现注册登录
**集成Bmob SDK** 在你的Android项目中,通过Gradle或Maven引入Bmob的SDK。
关于bmob系列教程
**云函数与云代码**: BMob还支持自定义云函数,开发者可以在服务器端编写JavaScript代码,实现复杂的业务逻辑,增强应用的功能。9.


