Update statement in Realm

前端 未结 2 1745
醉话见心
醉话见心 2021-02-14 05:38

I have VisitingCardPOJO form table. I want update single entry say where no=3

VisitingCardPOJO.java

public class VisitingC         


        
2条回答
  •  無奈伤痛
    2021-02-14 06:25

    I found the solution as and It worked

     public void updateNewCard(Realm realm, VisitingCardPOJO card) {
            realm.beginTransaction();
            VisitingCardPOJO toEdit = realm.where(VisitingCardPOJO.class)
                    .equalTo("no", card.getNo()).findFirst();
            toEdit.setName(card.getName());
            toEdit.setAddress(card.getAddress());
            realm.commitTransaction();
        }
    

    see demo for Realm

提交回复
热议问题