重新安装Android应用程序后,如何使我的数据库Sqlite Persistent数据

时间:2012-07-09 10:10:04

标签: sqlite

在模拟器中重新安装我的应用程序后,我在数据库Sqlite中找不到我的数据,所以我该怎么办(注意:我从文件.txt填充数据库)。 这是从SqliteOpenHelper

扩展的一些Class代码
private static final String CREATE_TABLE_CATEGORIE = "CREATE TABLE " + TABLE_CATEGORIE + " ("
        + COL_ID_CATEGORIE + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COL_INTITULE + " TEXT NOT NULL);";


private static final String CREATE_TABLE_BLAGUE = "CREATE TABLE " + TABLE_BLAGUE + " ("
        + COL_ID_BLAGUE + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COL_TITRE_BLAGUE + " TEXT NOT NULL, "
        + COL_DESC_BLAGUE + " TEXT NOT NULL, "+ COL_FAVORIS+" INTEGER DEFAULT 0, "
        +COL_ID_CATEGBLAGUE+" INTEGER NOT NULL, FOREIGN KEY (" 
        + COL_ID_CATEGBLAGUE+") REFERENCES "+TABLE_CATEGORIE+"("+COL_ID_CATEGORIE+"));";





public DbBlague(Context context, String name, CursorFactory factory,int version) {

    super(context, name, factory, version);

}

@Override
public void onCreate(SQLiteDatabase db) {

    db.execSQL(CREATE_TABLE_CATEGORIE);
    db.execSQL(CREATE_TABLE_BLAGUE);


}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    // TODO Auto-generated method stub

}

0 个答案:

没有答案