Search in sources :

Example 31 with BmobException

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();
            }
        }
    });
}
Also used : MyUser(com.yuxuan.admin.expression.entity.MyUser) BmobException(cn.bmob.v3.exception.BmobException) BmobUser(cn.bmob.v3.BmobUser) BmobQuery(cn.bmob.v3.BmobQuery)

Example 32 with BmobException

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();
            }
        }
    });
}
Also used : BmobException(cn.bmob.v3.exception.BmobException) UserDqInfomation(com.yuxuan.admin.expression.entity.UserDqInfomation) BmobQuery(cn.bmob.v3.BmobQuery) BmobUser(cn.bmob.v3.BmobUser) ArrayList(java.util.ArrayList) MyOrdersData(com.yuxuan.admin.expression.entity.MyOrdersData)

Aggregations

BmobException (cn.bmob.v3.exception.BmobException)32 BmobQuery (cn.bmob.v3.BmobQuery)16 BmobUser (cn.bmob.v3.BmobUser)12 MyUser (com.yuxuan.admin.expression.entity.MyUser)10 UpdateListener (cn.bmob.v3.listener.UpdateListener)9 List (java.util.List)6 Intent (android.content.Intent)5 UserDqInfomation (com.yuxuan.admin.expression.entity.UserDqInfomation)4 ArrayList (java.util.ArrayList)4 MyUser (com.fafu.zhengxianyou.livingincampus.bean.MyUser)3 DialogInterface (android.content.DialogInterface)2 TalentDao (cn.nicolite.palm300heroes.db.dao.TalentDao)2 Talent (cn.nicolite.palm300heroes.model.bean.Talent)2 SubscriptionHolder (com.itculturalfestival.smartcampus.network.SubscriptionHolder)2 MyOrdersData (com.yuxuan.admin.expression.entity.MyOrdersData)2 Subscription (rx.Subscription)2 Bitmap (android.graphics.Bitmap)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 Uri (android.net.Uri)1 AlertDialog (android.support.v7.app.AlertDialog)1