I've been having a LOT of trouble with Android database since I started my app two months ago... I went through many tutorials, but only few questions were answered... I gave up using my (real) device database, 'cause I couldn't have access to it, so I started using an emulator. But something weird happens. I have this class:
public class DatabaseHandler extends SQLiteOpenHelper
{
@Override
public void onCreate(SQLiteDatabase database)
{
database.execSQL(sql_command);
}
}
Whenever I uninstall the app, the database should be completely deleted from the (virtual) device, correct? But when I reinstall it and put a breakpoint in the execSQL() line (before the method is executed), I can see through SQLite Manager tab that the database is as it was before: The category table has only the _id, name, description, current_level and status.
The current sql command is (Notice the new image column int the Category table):
create table categories(
_id integer primary key autoincrement,
name text not null,
description text not null,
current_level integer DEFAULT 0,
status integer DEFAULT 0,
image text not null);
create table levels(
_id integer primary key autoincrement,
category_id integer not null,
level integer,
total_questions integer,
answered_questions integer DEFAULT 0,
correct_answers integer DEFAULT 0,
time integer DEFAULT 0);
Not only the image column is inserted, but also the level table doesn't show on the database. Besides, when I run the execSQL() method, nothing shows on the logcat tab.
By the way, I'm using Ubuntu 12.10, Eclipse Juno and Android 2.2!