0
contentValues.clear()
Hi, Please tell me, why <clear()> is used in the code bellow? Is it realy needed? ContentValues contentValues = new ContentValues(); db.execSQL("create table position (" + "id integer primary key, " + "name text, " + "salary integer" + ");"); for(int i = 0; i < position_id.length; i++) { contentValues.clear(); // ?? contentValues.put("id", position_id[i]); contentValues.put("name", position_name[i]); contentValues.put("salary", position_salary[i]); db.insert("position", null, contentValues);
1 ответ
+ 2
Clear() is a method of ContentValues which possibly extends Arraylist I dont think this is the full code so its difficut say but if it is then clear(); removes all elements from the list.