每日汇报
作者:互联网
学习增删改查
学习成果:
添加一行数据
首先创建JavaBean(对应为Bmob后台的数据表,更详细的解释请查看Android开发文档)
public class Person extends BmobObject {
private String name;
private String address;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
添加数据
Person p2 = new Person();
p2.setName("lucky");
p2.setAddress("北京海淀");
p2.save(new SaveListener<String>() {
@Override
public void done(String objectId,BmobException e) {
if(e==null){
toast("添加数据成功,返回objectId为:"+objectId);
}else{
toast("创建数据失败:" + e.getMessage());
}
}
});
标签:p2,name,每日,汇报,void,address,public,String 来源: https://www.cnblogs.com/D10304/p/14908959.html