I need to put some default data to database. I made method in my databasehelper:
private void putDefaultList(SQLiteDatabase db){
String nazwaa = null;
String mark = "0";
ArrayList<String> nazwa = new ArrayList<>();
nazwa.add("jjjjjj");
nazwa.add("kokoko");
for (int i =0; i<nazwa.size(); i++) {
nazwaa = nazwa.get(i);
db.execSQL("INSERT INTO " + TodoTable.TABLE_NAME + " (" + TodoTable.COL_2 + ", " + TodoTable.COL_3 + ") VALUES (" + "'" + nazwaa + "'" + ", " + "'" + mark + "'" + ")");
}
This method works but i need to have different languages so the simplest way is to get access to strings.xml but I don't know how in this situation.
I tried Resources.getSystem().getString(R.string.jjjjjj)); but this crash my app.
Aucun commentaire:
Enregistrer un commentaire