Week 7 Data Storage and Retrieval Module

Strict Mode, SQLite

Strict Mode

It is a mode to help find problems in code where things on the main thread works not as expected. This includes dis access, database access or network access.

Untitled

其实就是进入一个log模式来输出详细的log

SQLite

![Untitled 1](/2024/02/26/CS5520-Week7/Untitled 1.png)

![Untitled 2](/2024/02/26/CS5520-Week7/Untitled 2.png)

SQLite with ADB (Android Debug Bridge)

  1. Select a virtial devices that not play store support
    1. 不然不能使用super user (su)
1
2
3
4
5
6
7
8
adb -e shell (-e 是emulator)
su
找到 package name 对应的文件夹 (under /data/data)
找到database文件夹
找 *.db 文件
sqlite3 *.db
> SQL 操作
> .exit 退出

SQLite with Device File Explorer

Android Studio → View → Tool Windows → Device File Explorer

先下载到本地然后使用其他的工具打开 (有必要吗?晕了)

Android Room Persistence Library

The Android Room Persistence Library provides a high level interface on top of SQLite. It is worth using SQLite directly so that you get an understanding of what is underneath it all before you begin using the high level interface.