Exemplo n.º 1
0
  public void deleteDate() {
    Person p2 = new Person();
    p2.setObjectId("f36c5e3a36");
    p2.delete(
        this,
        new DeleteListener() {
          @Override
          public void onSuccess() {
            ToastUtils.setToastLong(MainActivity.this, "删除成功");
          }

          @Override
          public void onFailure(int code, String msg) {
            ToastUtils.setToastLong(MainActivity.this, "删除失败:" + msg);
          }
        });
  }
Exemplo n.º 2
0
  public void addDate() {
    final Person person = new Person();
    person.setName("lucky");
    person.setAddress("北京海淀");
    person.save(
        this,
        new SaveListener() {
          @Override
          public void onSuccess() {
            ToastUtils.setToastLong(
                MainActivity.this, "添加数据成功,返回objectId为:" + person.getObjectId());
          }

          @Override
          public void onFailure(int code, String msg) {
            ToastUtils.setToastLong(MainActivity.this, "创建数据失败:" + msg);
          }
        });
  }
Exemplo n.º 3
0
  public void changeDate() {
    // 更新Person表里面id为6b6c11c537的数据,address内容更新为“北京朝阳”
    final Person p2 = new Person();
    p2.setAddress("北京朝阳");
    p2.update(
        this,
        "f36c5e3a36",
        new UpdateListener() {
          @Override
          public void onSuccess() {
            ToastUtils.setToastLong(MainActivity.this, "更新成功:" + p2.getUpdatedAt());
          }

          @Override
          public void onFailure(int code, String msg) {
            ToastUtils.setToastLong(MainActivity.this, "更新失败:" + msg);
          }
        });
  }