I am trying to save data in Sugar DB(V 1.5)

24 Views Asked by At

Is there any .saveAll() method which I can use to save all the instances of a list from an API at once instead of saving by .save() method by iterating through the list.

1

There are 1 best solutions below

0
Md. Arif On BEST ANSWER

Look at the example below. Hope this will help.

List<Book> books = new ArrayList<>();
books.add(new Book("isbn123", "Title here", "2nd edition"))
books.add(new Book("isbn456", "Title here 2", "3nd edition"))
books.add(new Book("isbn789", "Title here 3", "4nd edition"))
SugarRecord.saveInTx(books);