Hi, writing an Android application that reads data from a SQLite
database created by a 3rd party camera.

I have added permission WRITE_EXTERNAL_STORAGE, but I still get
"attempt to write a readonly database" exception

I have tried different API levels and such, without any
difference.      I have checked the SDCard in the emulator isn't
readonly.

Code Snippet:

public class DatabaseHelper
{

    public static final String  DATABASE_NAME      = "MISC/EREVIEW.DB";
    public static final String  SHARE_TABLE         = "Share";
    public static final String  PICTURE_TABLE   = "Picture";

    private SQLiteDatabase      database;
    private File sdDir = Environment.getExternalStorageDirectory();

    public DatabaseHelper()
    {
        try
        {
            database = SQLiteDatabase.openDatabase(sdDir +
File.separator + DATABASE_NAME, null,SQLiteDatabase.OPEN_READWRITE);
        }
        catch (SQLiteException ex)
        {
            Log.e(TAG, "error -- " + ex.getMessage(), ex);
        }
        finally
        {
            DBUtil.safeCloseDataBase(database);
        }
    }
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to