int i=0;
ContentValues values = null;
for ( SortedMap.Entry<Integer, String> entry : mapDefect.entrySet() ) {
if( i++ < count )
continue;
if( i < arrlst.size() ) {
values = new ContentValues();
Log.d("MAP", "Id :"+entry.getKey()+"Des :"+entry.getValue()+"Co :"+ arrlst.get(i));
values.put( MARKER_COORD, arrlst.get( i ) );
values.put( MARKER_ID, entry.getKey() );
values.put( DEFECT_DESCRIPTION, entry.getValue() );
values.put( IMAGE_ID_F, imageID + 1 );
Log.d( "Err", "in insertNewDefectsDescription" );
long rowId = db.insert( TABLE_DEFECTS, null, values );
long rowId1 = rowId;
i++;
}
}
So, I want to access the arraylist only after the count variable, which is why the:-
if(i++<count)
continue;
But, when I insert a break point at the ‘insert’ line, it is not working. The line is not executing at all, and hence the data is not being inserted into the database. What has gone wrong??
The ‘values’ are null.
Your code is little difficult to understand
following are my suggestions
1.why don’t you do i=count before the for loop. it would save a lot of iterations
2. Your i may be incremented twice for example
even if the condition is false i++ happens any your i gets incremented then inside
the logic gets wrong here