vendredi 28 août 2015

Query SQLite Database on External Storage with Android App

I need to write an Android app that can query a SQLite database that is stored on a device's external storage, but I cannot figure out how despite everything I have looked at online, most of which was on StackOverflow. Here's the constructor for the class that I want to use to work with the database. I believe that this piece of code is sufficient information for my question, but if it is not, I can provide more.

public KetaiSQLite(PApplet p, String dbName, int dbVersion, String dataRootDir)
{
    this.context = p.getActivity().getApplicationContext();
    DATABASE_NAME = dbName;
    DATABASE_VERSION = dbVersion;
    DATA_ROOT_DIRECTORY = dataRootDir;
    OpenHelper openHelper = new OpenHelper(this.context, dbName);
    this.db = openHelper.getWritableDatabase();
}

How can I modify this so that I can query from a database on external storage? At the moment, db.getPath() returns /data/data/http://ift.tt/1WYp08o.

Aucun commentaire:

Enregistrer un commentaire