There is a certain table in SQLite from it we display all values in a string variable.
Here is what I realized:
Cursor cursor = mDB.rawQuery("SELECT * FROM "+ TABLE, null); int result = cursor.getColumnCount(); int result1 = cursor.getCount(); int result2 = result*result1; // количество значений в таблице (получилось то, что нужно) String [] def = new String[result2-2]; def [0] = " 1 "; //первое значение мне нужно своё и дальше я добавляю данные начиная с 3. for (int d = 0; d < result1-1; d++) { Cursor cursor1 = mDB.rawQuery("SELECT * FROM "+ TABLE + " WHERE ID = " + d, null); if (cursor1.moveToFirst()) { for (int j = 0; j < result2; j++){ do { for (int k = 3; k < result-1; k++){ j=+1; def [j] = cursor1.getString(k); /* здесь ошибка E/AndroidRuntime: FATAL EXCEPTION: main Process: anem.tr, PID: 2580 android.database.CursorIndexOutOfBoundsException: Index 1 requested, with a size of 1 */ } } while (cursor1.moveToNext());} } } return def; } From an error, I can understand that my cursor is not on that value and just does not move further, but where I can’t figure it out, so I ask for help. In the simple case, when I work with one line, everything works.
d <=result1-1- JVic