通过LitePal保存集合到本地(可增删改查)

时间:2022-01-06 03:23:47
【文件属性】:

文件名称:通过LitePal保存集合到本地(可增删改查)

文件大小:4.94MB

文件格式:7Z

更新时间:2022-01-06 03:23:47

本地保存

通过LitePal保存集合到本地(可增删改查) compile 'org.litepal.android:core:1.3.2' 第一步建立 Connector.getDatabase(); 保存: Book book = new Book(); book.setName("The Da Vinci Code"); book.setAuthor("Dan Brown"); book.setPages(454); book.setPrice(16.96); book.setPress("Unknow"); book.save(); 更新: Book book = new Book(); book.setPrice(14.95); book.setPress("Anchor"); book.updateAll("name = ? and author = ?", "The Lost Symbol", "Dan Brown"); 删除: DataSupport.deleteAll(Book.class, "price < ?", "15"); 查询: List books = DataSupport.findAll(Book.class);


网友评论