vendredi 6 février 2015

I am getting an error while inserting a array list into sqlite database...I am new to android.I am getting the following error


at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:252)


02-06 16:49:38.933: E/AndroidRuntime(6767): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)



for (int i = 0; i < list.size(); i++) {
ContentValues cv = new ContentValues();
HashMap<String, String> map = new HashMap<String, String>();
map = list.get(i);

if(map != null) {
cv.put(DatabaseAppHelper.KEY_VACCINE_NAME, map.get("vaccine"));
cv.put(DatabaseAppHelper.KEY_DOSE, map.get("Dose"));
cv.put(DatabaseAppHelper.KEY_VACCINE_DETAILS,
map.get("Vaccine_details"));
cv.put(DatabaseAppHelper.KEY_RECOMMENDED_VACCINATION_DAY,
map.get("Doseday"));
cv.put(DatabaseAppHelper.KEY_LATEST_VACCINATION_DAY,
map.get("LatestRecomendedVac"));
cv.put(DatabaseAppHelper.KEY_PRE_REQUISITE,
map.get("Pre-Requisite"));
db.insert(DatabaseAppHelper.TABLE_VACCINE_DETAILS, null, cv);
Log.i(DatabaseAppHelper.KEY_VACCINE_NAME, map.get("vaccine"));
} else {
Log.i("GET", "NULL");
}
`First time the loop is working properly...from second time it is showing the error`.

Aucun commentaire:

Enregistrer un commentaire