How do I bulkinsert arraylist of objects - Android Content Provider -


how perform bulkinsert on arraylist of objects?

i have arraylist of book , want use bulkinsert function of content provider insert in bulk list of books;

here arraylist of book:

    private arraylist<book> booklist;  here code try bulkinsert // insert data database public void insertdata() {     contentvalues bookvalues = new contentvalues();      for(book book: booklist){        bookvalues = new contentvalues();        bookvalues.put(bookcontract.bookentry.column_id, book.getbook_id());        bookvalues.put(bookcontract.bookentry.column_title, book.gettitle());        bookvalues.put(bookcontract.bookentry.column_overview, book.getdescription());      }      // finally, insert book data database.        getactivity().getcontentresolver().insert(                bookcontract.bookentry.content_uri, bookvalues        );       } 


Comments