realm1.beginTransaction();
newuser tripnew = realm1.createObject(newuser.class);
int nid= (int)(realm.where(newuser.class).max("nid").intValue()+1);
tripnew.setNid(nid);
tripnew.setFrom(frominput.getText().toString());
tripnew.setTo(toinput.getText().toString());
tripnew.setDatejourney(dateinput.getText().toString());
realm1.commitTransaction();
updatetrip();
/// iam also use this code not working
realm.where(newuser.class).maximumInt("id_cp") + 1;
newuser.java//////
public class newuser extends RealmObject {
private String from,to,datejourney;
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public String getDatejourney() {
return datejourney;
}
public void setDatejourney(String datejourney) {
this.datejourney = datejourney;
}
}