N
N
nikita_chiru2016-07-22 13:26:26
Java
nikita_chiru, 2016-07-22 13:26:26

How to delete string in Sugar ORM by name?

add - added, but I can not remove ...
how to delete a line by name?

public class Izb extends SugarRecord {
    int price;
    int image;
    String sostav;
    @Unique
    String name;


    public Izb() {
    }

    public Izb(String name, int price, int image, String sostav) {
        this.name = name;
        this.price = price;
        this.image = image;
        this.sostav = sostav;

    }

    @Override
    public String toString() {
        return "Izb{" +
                "name='" + name + '\'' +
                ", mail='" + price + '\'' +
                ", image='" + image + '\'' +
                '}';
    }
}

List<Izb> mData = Izb.listAll(Izb.class);
        mListView = (ListView)findViewById(R.id.listView);
        mAdapter = new MyAdapater(this,R.layout.item_content,R.layout.item_action_izb,mData);
        mListView.setAdapter(mAdapter);


Izb izb = Izb.findById( name);
                    izb.delete();

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question