I've got a problem that I cannot resolve; I searched in web, but I didn't find a precise solution, or at least I didn't understand very well, I don't know.
Anyway, I've got Android Studio v. 2.1, and here's what I'm trying to do:
At first I created an SQLite Database overriding the onCreate
method, than, in another override of the same method, I wrote a method that checks if the database is empty; if true, it'll add around 300000 words.
Here's this part:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Database db = new Database(getApplicationContext());
db.open();
if (db.queryTutteParole().getCount() == 0) {
db.inserisciParole("pane", "no");
db.inserisciParole("latte", "no");
db.inserisciParole("uovo", "no");
db.inserisciParole("farina", "no");
db.inserisciParole("sale", "no");
//and all the remaining words
}
db.close();
}
To clarify: queryTutteParole()
is a method that returns a cursor of all that's in the database, and inserisciParole()
puts the words with their value in the database.
Well, no errors with the code (I tested with only 5 words put), but if I put all the 300000+ words and I try to run it on my device, I have these errors:
Here's the image with the errors
What I should do?
Thanks :)