You can access a database stored on you sdcard by using:
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
public class MyClass {
private SQLiteDatabase myDB = null;
// Constructor
public MyClass() {
try {
myDB = SQLiteDatabase.openDatabase(stPathToDB, null, SQLiteDatabase.NO_LOCALIZED_COLLATORS|SQLiteDatabase.OPEN_READONLY);
} catch (SQLException e) {
e.printStackTrace();
}
}
// Destructor
public void finalize() {
myDB.close();
}
}
NO_LOCALIZED_COLLATORS = to open the database without support for localized collators.
In order to get the path to your sdcard you can use:
stPathToDB = android.os.Environment.getExternalStorageDirectory().toString()+"/dbase.sqlite"
Rgds
Layne