With the help of Sugar ORM you can get the value by id

Contact title = Contact.findById(Contact.class, 2); String titleStr = title.title; 

Is it possible to get an id on the contrary by value?

Completely get all the fields can be by value, so obrozom

 List<Contact> authors = Contact.find(Contact.class, "name = ?", "Nathan"); 

I can not figure out how to get exactly the id of the element, where the values ​​of one field, for example "Nathan" ???

  • one
    Well, if you know that such a value can be only one, then just take the first element of the list and take its ID - YuriySPb
  • Thank. I understood. He did something like this, now everything seems to be working as it should) - Artsait

0