Modify and operate the database after Android studio imports the external sqlite database

Precondition: The external sqlite database has been imported, and the database import method can refer to the external sqlite database to import Android projects

The most stupid (simple and intuitive) method is to export the database operation and then import it

1. According to the picture below, find Device File Explorer.

2. Find the data directory of the data file, this supplementary record stores your Android project

 3. Find the corresponding project file, open the project file, and find the database to be operated under the databases file

 3. Select the database file and click save as to save the file as, and then open the database through the existing database operation file for operation

4. After the operation is completed, replace the database file with the same name under the assets file under the Android project, and the operation can be completed

Using the Database Inspector inside Android studio

This method cannot actually change the externally imported database (that is, the database under the assets file), but can only operate the imported database in the virtual memory.

1. Operate as shown in the figure to get the database you imported

Note: The simulator must be run first, otherwise the corresponding database file cannot be found

 The display results are as follows:

 2. To operate the data table, if you only need to change the data in the table, click the corresponding data to make corresponding modifications. If you need to delete or add a series of operations, you can use the method shown in the figure to add query query, and use sql statement to query the database perform the required operations

 

Guess you like

Origin blog.csdn.net/NXBBC/article/details/123734221