CursorOutofBoundsException Index -1 requested with size of 0

change your insertion code to this:

            SQLiteDatabase db7 = db.getWritableDatabase();
            ContentValues values5= new ContentValues();
            for (int i = 0; i < poslist.size(); i++) {
            values5.put(DBManager.TableInfo.KEYID, ID1);
            values5.put(DBManager.TableInfo.DOCU, document);
            values5.put(DBManager.TableInfo.ATTEND,attendancelist.get(i));
            values5.put(DBManager.TableInfo.EMAIL, emaillist.get(i));
            values5.put(DBManager.TableInfo.PARTY,partytypelist.get(i) );
            values5.put(DBManager.TableInfo.BIO,biometriclist.get(i));
            values5.put(DBManager.TableInfo.KEY_LOGIN_USER,username2);
            String condition5 = DBManager.TableInfo.DOCU + " =?";
            Cursor cursor5 = db7.query(DBManager.TableInfo.UPDATEPARTY, null, condition5, new String[]{DBManager.TableInfo.ATTEND}, null, null, null);
            long status5 = db7.insert(DBManager.TableInfo.UPDATEPARTY, null, values5);
            System.out.println( "Parties insert : " + status5);
            cursor5.close();
            db7.close();
        }

Leave a Comment