use of cn.bmob.v3.exception.BmobException in project expression by happy-yuxuan.
the class UMyInfomationActivity method setDataTOView.
// 设置数据到界面上
private void setDataTOView() {
// 获取缓存用户
BmobUser userQuery = MyUser.getCurrentUser();
// 获取缓存用户的用户名
String cacheUsername = userQuery.getUsername();
// 开始查询用户资料
BmobQuery<MyUser> query = new BmobQuery<MyUser>();
query.addWhereEqualTo("username", cacheUsername);
query.findObjects(new FindListener<MyUser>() {
@Override
public void done(List<MyUser> object, BmobException e) {
if (e == null) {
MyUser user = object.get(0);
String nichen = user.getUsername();
String phoneNumber = user.getMobilePhoneNumber();
String email = user.getEmail();
String idCard = user.getIdCard();
String realName = user.getRealName();
// 查询成功后将数据设置到EditText上
et_nichen.setText(nichen);
et_mail.setText(email);
et_idCard.setText(idCard);
et_phoneNumber.setText(phoneNumber);
et_real_name.setText(realName);
} else {
Toast.makeText(UMyInfomationActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
}
use of cn.bmob.v3.exception.BmobException in project expression by happy-yuxuan.
the class UMyOrdersActivity method queryData.
// 查数据
private void queryData() {
dialog.show();
List<BmobQuery<UserDqInfomation>> queries = new ArrayList<BmobQuery<UserDqInfomation>>();
BmobQuery<UserDqInfomation> q1 = new BmobQuery<UserDqInfomation>();
q1.addWhereEqualTo("success", false);
BmobUser user = MyUser.getCurrentUser();
String username = user.getUsername();
BmobQuery<UserDqInfomation> q2 = new BmobQuery<UserDqInfomation>();
q2.addWhereEqualTo("username", username);
queries.add(q1);
queries.add(q2);
BmobQuery<UserDqInfomation> query = new BmobQuery<UserDqInfomation>();
query.and(queries);
query.findObjects(new FindListener<UserDqInfomation>() {
@Override
public void done(List<UserDqInfomation> object, BmobException e) {
if (e == null) {
if (object.size() == 0) {
handler.sendEmptyMessage(CACHE_DATA_FAIL);
return;
}
data.clear();
L.i("queryData = " + object.size());
MyOrdersData buffer;
for (UserDqInfomation u : object) {
buffer = new MyOrdersData();
buffer.setAddr(u.getAddr());
buffer.setPhoneNumber(u.getDq_phone());
queryUsername(u.getDq_phone(), buffer);
}
} else {
L.i("queryData失败:" + e.getMessage());
handler.sendEmptyMessage(CACHE_DATA_FAIL);
Toast.makeText(UMyOrdersActivity.this, "加载失败", Toast.LENGTH_SHORT).show();
}
}
});
}
Aggregations