我正在进行Android测验,而且我使用SQLite拥有本地数据库。即使我已经更改了要显示的问题,也会显示相同的旧问题。
private void addQuestions()
{
Question q1=new Question("What food makes up nearly all (around 99%)" +
" of a Giant Panda’s diet?","Bamboo", "Bananas", "Grass", "A");
this.addQuestion(q1);
}
// Adding new question
public void addQuestion(Question quest) {
//SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_QUES, quest.getQUESTION());
values.put(KEY_ANSWER, quest.getANSWER());
values.put(KEY_OPTA, quest.getOPTA());
values.put(KEY_OPTB, quest.getOPTB());
values.put(KEY_OPTC, quest.getOPTC());
// Inserting Row
dbase.insert(TABLE_QUEST, null, values);
}
答案 0 :(得分:0)
将Sqlite版本更新为加1。
private static final int DATABASE_VERSION = 2;
到
private static final int DATABASE_VERSION = 3;
这将使您的应用程序创建新数据库并只插入新数据