View SQLite data on an Android tablet - SQLite Database Browser

I successfully inserted some data into my sqlite database (I confirmed this by printing out the long identifier that was returned from the insert, and it was something other than -1), so I know that it is. the problem is that the sqlite database that I am browsing with the SQLite Database Browser is in the resources folder (I used this to copy the data already made for other tables to the tablet directory) - in this case / data / data / packagename / files / -

The tablet is a Motorola xoom ICS (4.0.3) and is being developed on macbook pro. Any suggestions on what I can use to view the data?

adb program is in android-sdk-mac_x86 / platform tools, and I execute the following command:

./adb shell

  • but I get nothing but permission issues. I saw where someone suggested the Firefox add-on, but ... really? Is this the best there is? It seems like developers will be better off looking for their data in a database. If you are going to embed material in a database, you want to look at the contents in case you need to debug your chosen ones later (as a very good example).

EDIT: I cannot get the firefox plugin to work. It does not seem to recognize any external devices.

any ideas? thanks.

+4
source share
4 answers

I had a similar problem - and decided to put a button in the application that, when I click on it, copies the database to the SD card. Then you can use DDMS to copy the database from the SD card to the connected computer and run everything you want to check, check the values, etc.

package com.me.myPackage; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.text.SimpleDateFormat; import java.util.Date; import android.content.Context; import android.os.Environment; import android.widget.Toast; public class Utility { public static void backupDatabase(Context context) throws IOException { // Open your local db as the input stream String inFileName = PATH_TO_YOUR_DB; File dbFile = new File(inFileName); FileInputStream fis = new FileInputStream(dbFile); File outputDirectory = new File( Environment.getExternalStorageDirectory() + "/PATH_FOR_BACKUP"); outputDirectory.mkdirs(); SimpleDateFormat sdf = new SimpleDateFormat(Constants.DATE_TIME_FORMAT_FOR_DATABASE_NAME); // append date time to db name String backupFileName = "/MyApp_" + sdf.format(new Date()) + ".db3"; String outFileName = outputDirectory + backupFileName; // Open the empty db as the output stream OutputStream output = new FileOutputStream(outFileName); // transfer bytes from the inputfile to the outputfile byte[] buffer = new byte[1024]; int length; while ((length = fis.read(buffer)) > 0) { output.write(buffer, 0, length); } // Close the streams output.flush(); output.close(); fis.close(); Toast.makeText(context, "Database backup complete", Toast.LENGTH_LONG) .show(); } 

}

+1
source

I'm not sure if this is exactly what you need, but you can install paw , the android web server .. then install the paw php plugin, then use pdo to view the data (as well as to create and modify data). Once you get this, if you need something other than a cli-like interface, you can try something like this .

+1
source

A completely different way might be to use the android sdk sqlite library, maybe you can use it via cli.

0
source

Here is the answer using adb: Exploring sqlite3 databases from a remote shell

 $ adb -s emulator-5554 shell # sqlite3 /data/data/com.example.google.rss.rssexample/databases/rssitems.db SQLite version 3.3.12 Enter ".help" for instructions .... enter commands, then quit... sqlite> .exit 
0
source

Source: https://habr.com/ru/post/1402808/


All Articles