room数据库的使用

SearchView一个类似百度搜索框关键字搜索效果的实现
https://blog.csdn.net/qq_42177292/article/details/81158423

Room数据库详实使用指北(附Demo)
https://blog.csdn.net/langlitaojin/article/details/88400659
https://blog.csdn.net/chenrenxiang/article/details/84067783
https://zhuanlan.zhihu.com/p/77036077

1.在app的build.gradle中加入room的相关依赖。

def room_version = "2.2.0-alpha01"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"

2.创建一个关于学生的Entity,即创建一张学生表。

@Entity(tableName = "student")
public class Student
{

    @PrimaryKey(autoGenerate = true)
    @ColumnInfo(name = "id", typeAffinity = ColumnInfo.INTEGER)
    public int id;

    @ColumnInfo(name = "name", typeAffinity = ColumnInfo.TEXT)
    public String name;

    @ColumnInfo(name = "age", typeAffinity = ColumnInfo.TEXT)
    public Strin

Original: https://blog.csdn.net/qq_40204114/article/details/120050768
Author: 仰望星辰的羊
Title: room数据库的使用

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/817077/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球