Export table from BD to .txt file in Android Studio

0

I need to export a database to a .txt file delimited by commas, I have researched but I can not find the way, I need the files to be shown in this way:

  

Data, Data, Data
  Data, Data, Data

How can I do it?

    
asked by Humberto Arciniega 14.10.2018 в 23:46
source

1 answer

-1

You have two ways that occur to me:

1) Connect by console using adb . Once connected what you have is a unix terminal and you have to do cd up to the folder of your app ( /data/data/<nombre de paquete> ), and then cd to the folder databases . In that folder you will see your database (ends with .db). To open it, you execute slqlite3 <nombre de la base de datos incluyendo la extensión> That opens the console of sqlite and you can queries and see the data of your base, and I think that you also send the results to a file on your pc.

2) With Android Studio you can open the file browser ( View -> Tool Windows -> Device File Explorer ), search the database in the folder described in the previous item, and download the file from the database to your pc. Once downloaded, you install SQLite ( link ) and you can open the file on your computer. From there you can run queries and save queries as a txt file.

    
answered by 15.10.2018 в 00:25