I study how to work with SQLite when creating android applications, doing a small task on test development (quiz). This test stores questions and answers in a database, I make it based on a video of one German - if necessary, I will give a link to the channel / code.
So, in the code of the method that fills the database with questions, I made a mistake - when copying the first line I did not change it inadvertently, and instead
private void fillQuestionsTable() { Question q1 = new Question("A is correct", "A", "B", "C", 1); addQuestion(q1); Question q2 = new Question("B is correct", "A", "B", "C", 2); addQuestion(q2); Question q3 = new Question("C is correct", "A", "B", "C", 3); addQuestion(q3); Question q4 = new Question("A is correct again", "A", "B", "C", 1); addQuestion(q4); Question q5 = new Question("B is correct again", "A", "B", "C", 2); addQuestion(q5); } I have had
private void fillQuestionsTable() { Question q1 = new Question("A is correct", "A", "B", "C", 1); addQuestion(q1); Question q1 = new Question("A is correct", "A", "B", "C", 1); addQuestion(q1); Question q1 = new Question("A is correct", "A", "B", "C", 1); addQuestion(q1); Question q1 = new Question("A is correct", "A", "B", "C", 1); addQuestion(q1); Question q1 = new Question("A is correct", "A", "B", "C", 1); addQuestion(q1); } Accordingly, everything is recorded in the database.
I immediately corrected this error after I found it, but when I started the emulator (I usually work with the Nexus 5X API 26 x86 device), nothing changed - every time the same first question was displayed.
I checked that already different questions are entered into the database using the DB browser for SQLite - indeed, there were already different questions in the database table, and not the first one, repeated five times, as at the very beginning.
As a result, I thought of launching another device on the emulator (Nexus 5 API 26) - and it all worked. It turns out that for the first device, the data transmitted for the first time to the database has been cached.
Somehow you can delete the cache only for this device in the emulator or will it be easier to delete the Nexus 5X API 26 x86 and then reinstall it?