Reputation: 975
I would like to remove the data on my ObjectBox database in Android based on its Id. Is this correct?
Box<Cart> box = ObjectBox.get().boxFor(Cart.class);
Cart order = box.get(id);
box.remove(order);
Thank you
Upvotes: 1
Views: 2197
Reputation: 7090
The remove
method is overloaded and there are variants accepting the following arguments:
Thus, you can directly remove by ID like this:
box.remove(id);
For more details, please check the API docs of the Box class.
Upvotes: 2