node.js - Update row with Loopback.js in Android -


i create restful api loopback(node.js) android app. can use findbyid, destroy etc. when try update data work first_name. how can solve problem?

my codes : mainactivity

 public void guncelle(view view) {     repository.findbyid(user_id.gettext(), new modelrepository.findcallback<users>() {         @override         public void onsuccess(users user) {             if (user == null) {                 toast.maketext(getapplicationcontext(), "hata oluştu!", toast.length_short).show();             } else {               user.put("first_name", first_name.gettext()); //this work               user.put("last_name", last_name.gettext()); // nope           user.put("email", email.gettext()); //nope                user.put("username", username.gettext()); // , nope :(                  user.save(new voidcallback() {                     @override                     public void onsuccess() {                         toast.maketext(getapplicationcontext(), "güncelleme başarılı", toast.length_short).show();                     }                      @override                     public void onerror(throwable t) {                         toast.maketext(getapplicationcontext(), "hata oluştu!", toast.length_short).show();                         log.d("hata: ", string.valueof(t));                     }                 });             }         }          @override         public void onerror(throwable t) {             toast.maketext(getapplicationcontext(), "hata oluştu!", toast.length_short).show();             log.d("hata: ", string.valueof(t));         }      }); } 

users

public class users extends model {  private string first_name, last_name, email, username;  public void setfirst_name(string first_name) {     this.first_name = first_name; }  public string getfirst_name() {     return first_name; }  public void setlast_name(string last_name) {     this.last_name = last_name; }  public string getlast_name() {     return last_name; }  public void setemail(string email) {     this.email = email; }  public string getemail() {     return email; }  public void setusername(string username) {     this.username = username; }  public string getusername() {     return username; } } 

i found solution. i'm using old codes in github new ones work.

        users user= repository.createobject(immutablemap.of("id", 2));     user.setfirst_name("name");     user.setlast_name("surname");     user.setemail("email");     user.setusername("username");     user.save(new voidcallback() {         @override         public void onsuccess() {             // pencil exists on server!         }          @override         public void onerror(throwable t) {             // save failed, handle error         }     }); 

Comments