Ok guys.. I've tried and tried in the hope not to be forced to bother you.
but I have to :)
I'm trying to do a simple thing.. creating a DB when my activity first
starts:
@Override
    public void onCreate(Bundle savedInstanceState) {

        currenciesDB = new CurrenciesDB(this);
        currenciesDB.open();

 }

then in my CurrenciesDB constructor/open:

public CurrenciesDB(Context mCtx) {
this.ctx = mCtx;
}
public CurrenciesDB open() throws SQLException {
this.dbHelper = new CurrencyStorageHelper(this.ctx);
this.db = dbHelper.getWritableDatabase();
 return this;
}


and, as you might reckon, my CurrencyStorageHelper class extends the
SQLOpenHelper class and specifically:
public CurrencyStorageHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}

@Override
public void onOpen(SQLiteDatabase db) {
super.onOpen(db);
Log.d(TAG, "Opening the database... " + db.getPath() + " version " +
db.getVersion());
db.setLockingEnabled(true);
}
 @Override
public void onCreate(SQLiteDatabase database) {
database.execSQL(DATABASE_CREATE_1);
 Log.d(TAG, "Creating table..." + DATABASE_CREATE_2);
database.execSQL(DATABASE_CREATE_2);
Log.d(TAG, "Creating table..." + DATABASE_CREATE_3);
database.execSQL(DATABASE_CREATE_3);
 insertDefinitions(database);
insertInitialCurrencies(database);
}

What is happening here is that despite launcing the "CREATE TABLE"
statements, nothing gets created on the database. After those statements I
even insert records using SQLiteDatabase.insert. But nothing happens.. no
expections and no records get created.
Afterward, when I try to query the DB, I get an option saying that the table
I'm trying to query doesn't (obviously) exists.
I'm not a newbie developer and I've tried to debug my app as much as I
can/know but I have only these clues:
1. During the debug process, the instance of SQLiteDatabase has a
mStrackTrace private attribute set to DatabaseObjectNotClosedException, but
obviously no cursor has been opened.. yet.
2. The db version gets set to zero :(
3. Same behaviour using the Emulator and my Samsunga Galaxy S2 2.3.3 (hence
no wrong configuration of the emulator).

If you had patient to go through the entire email I hope you have even one
single clue on why this is happening (maybe you experienced the same
problem?? ) !!

Log.d("Nico", "THANK YOU");

Nico

-- 
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