Android Studio About SQLite Visualization Database Inspetor

Due to the particularity of SQLite, SQLite Expert Personal is used in classrooms and textbooks , but I think it is not very useful and very troublesome

In fact, in Android Studio, you have to have an emulator API higher than 26 (this parameter is searched online)

You can directly view the SQLite database in AS. (Only use the simulator that comes with AS)

Database Inspector

It is worth mentioning that SQLite data can be edited, and the mobile phone will be synchronized

location at

 Databases on the left is the database and the tables under the database, and the right is the tables and data. The detailed diagram can be seen as follows:

 You need to select the emulator and APP package name on the upper right, or you can directly run the current project, and the current emulator and project package name will be automatically selected

Some databases have not yet executed the statement to create the database and table, and a red cross will be displayed

The connection can be closed first

 Then it will enter a DEAD, showing all databases and tables

Or turn on the keep connected function, the following icon is on (orange lock)

The data is in real time

You can write SQL statements through the query function to add, delete, modify, and check, for example:

Inquire

 Add

 ......

 You can also directly edit the data in the table (double-click) and save it automatically after losing focus

Digression: How to find the .db file of SQLite

1. Android Studio opens Device File Exlorer in the right column (or in View-Tools Windows at the top of AS)

 2. Select the emulator that the project runs on

 

3. Open data/data in the directory

 4. First look at your own project package name (under two views)

 

5. Find the corresponding package name in the directory and open databases (by mentioning, shared_prefs is the xml file stored in SP storage)

The db file is the .db file of SQLite

5-9 Supplement: Some Android Studio versions cannot find the Database Inspetor, as shown in the figure below, in fact, because the Database Inspetor function has been moved to the App Inspetor, just click on the App Inspetor:

 

Guess you like

Origin blog.csdn.net/m0_59558544/article/details/130544673
Recommended