Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You still can access the database if you have the root access through shell commands : </p> <p>Example : </p> <pre><code>mycomp$ adb shell $ su # cd com.android.providers.media # ls cache databases lib shared_prefs # cd databases # ls external.db external.db-shm external.db-wal internal.db internal.db-shm internal.db-wal # sqlite3 external.db SQLite version 3.7.11 2012-03-20 11:35:50 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite&gt; select count(*) from images; 10 sqlite&gt; </code></pre> <p>The tool used is sqlite3 which is a client command to an sqlite database. The database files are usually located in /data/data/com.someapp/databases/.</p> <p>Edit : Wait... I was re reading your question. Do you mean you want to access a database of another app from your own app?</p> <p>Edit : If you want to access another database, the other database has to be a content provider. The best example of that is the media library (the image table above is the table that content the picture in your device). Code sample : </p> <pre><code> // which image properties are we querying String[] projection = new String[] { BaseColumns._ID, ImageColumns.BUCKET_DISPLAY_NAME, ImageColumns.DATE_TAKEN, MediaColumns.TITLE, MediaColumns.DATA }; // Get the base URI for the image table in the Contacts content provider. Uri images = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; // Make the query. Cursor cur = context.managedQuery(images, projection, // Which columns to return "", // Which rows to return (all rows) null,//selection, // Selection arguments (none) ImageColumns.DATE_TAKEN + " DESC"// Ordering ); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload