ceci est mon code:CursorIndexOutOfBoundsException avec cursor.getInt()
Log.d("MYTAG", "random number -->" + randomNumber);
idRandomCards[i] = cursorTypeZero.getInt(randomNumber);
c'est l'erreur Log:
7620-7620/package D/MYTAG﹕ random number -->94
04-02 16:06:51.804 7620-7620/package D/AndroidRuntime﹕ Shutting down VM
04-02 16:06:51.804 7620-7620/package W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41bafda0)
04-02 16:06:51.854 7620-7620/package D/dalvikvm﹕ GC_FOR_ALLOC freed 1283K, 45% free 9237K/16608K, paused 42ms, total 46ms
04-02 16:06:51.864 7620-7620/package E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: package, PID: 7620
android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 206
at ecc
comme vous le verrez, le nombre aléatoire dans ce cas, a la valeur 94. le curseur.getCount() = 206.
pourquoi j'ai cette exception?
Je ne veux pas utiliser la méthode cursor.getColumnIndexOrThrow(), car j'ai besoin d'une ligne aléatoire.
quelqu'un peut m'aider?