0

私のコードの不完全な部分:

        System.out.println(frame + ", " + ((frame / 10) % 2) + ", " + dyingBoxRelated[1] + ", "
                + (bad[dyingBoxRelated[1]][0] - radBad) + ", "
                + (bad[dyingBoxRelated[1]][1] - radBad) + ", " + radBad + ", "
                + littleBad[(frame / 10) % 2]);
        try {
            canvas.drawBitmap(littleBad[(frame / 10) % 2], bad[dyingBoxRelated[1]][0] - radBad,
                    bad[dyingBoxRelated[1]][1] - radBad, null);
        } catch (Exception e) {
            System.out.println(e);
        }

ここで何が起こっているのか本当に理解できません。変数のすべての値を監視するために、try-catch の上に System.out を追加したところ、次のようになりました。

...
06-04 10:35:48.785: I/System.out(9786): 409, 0, 1, 484.2473, 34.78183, 50.0, android.graphics.Bitmap@40fbd428
06-04 10:35:48.830: I/System.out(9786): 410, 1, 1, 484.2473, 34.78183, 50.0, android.graphics.Bitmap@40fc0a18
06-04 10:35:48.875: I/System.out(9786): 411, 1, 1, 484.2473, 34.78183, 50.0, android.graphics.Bitmap@40fc0a18
06-04 10:35:48.915: I/System.out(9786): 412, 1, 1, 484.2473, 34.78183, 50.0, android.graphics.Bitmap@40fc0a18
06-04 10:35:48.955: I/System.out(9786): 413, 1, 1, 484.2473, 34.78183, 50.0, android.graphics.Bitmap@40fc0a18
06-04 10:35:48.995: I/System.out(9786): 414, 1, 1, 484.2473, 34.78183, 50.0, android.graphics.Bitmap@40fc0a18
06-04 10:35:49.045: I/System.out(9786): 415, 1, 1, 484.2473, 34.78183, 50.0, android.graphics.Bitmap@40fc0a18
06-04 10:35:49.095: I/System.out(9786): 416, 1, 1, 484.2473, 34.78183, 50.0, android.graphics.Bitmap@40fc0a18
06-04 10:35:49.140: I/System.out(9786): 417, 1, 1, 484.2473, 34.78183, 50.0, android.graphics.Bitmap@40fc0a18
06-04 10:35:49.145: I/System.out(9786): java.lang.ArrayIndexOutOfBoundsException: length=2; index=-1646894335
06-04 10:35:49.185: I/System.out(9786): 418, 1, 1, 484.2473, 34.78183, 50.0, android.graphics.Bitmap@40fc0a18
06-04 10:35:49.185: I/System.out(9786): java.lang.ArrayIndexOutOfBoundsException: length=2; index=-45811
06-04 10:35:49.230: I/System.out(9786): 419, 1, 1, 484.2473, 34.78183, 50.0, android.graphics.Bitmap@40fc0a18
06-04 10:35:49.230: I/System.out(9786): java.lang.ArrayIndexOutOfBoundsException: length=2; index=-45811
06-04 10:35:49.270: I/System.out(9786): 420, 0, 1, 484.2473, 34.78183, 50.0, android.graphics.Bitmap@40fbd428
06-04 10:35:49.270: I/System.out(9786): java.lang.ArrayIndexOutOfBoundsException: length=2; index=-45812
06-04 10:35:49.315: I/System.out(9786): 421, 0, 1, 484.2473, 34.78183, 50.0, android.graphics.Bitmap@40fbd428
06-04 10:35:49.315: I/System.out(9786): java.lang.ArrayIndexOutOfBoundsException: length=2; index=-45812
06-04 10:35:49.355: I/System.out(9786): 422, 0, 1, 484.2473, 34.78183, 50.0, android.graphics.Bitmap@40fbd428
06-04 10:35:49.355: I/System.out(9786): java.lang.ArrayIndexOutOfBoundsException: length=2; index=-45812
06-04 10:35:49.395: I/System.out(9786): 423, 0, 1, 484.2473, 34.78183, 50.0, android.graphics.Bitmap@40fbd428
06-04 10:35:49.395: I/System.out(9786): java.lang.ArrayIndexOutOfBoundsException: length=2; index=-45812
06-04 10:35:49.435: I/System.out(9786): 424, 0, 1, 484.2473, 34.78183, 50.0, android.graphics.Bitmap@40fbd428
06-04 10:35:49.435: I/System.out(9786): java.lang.ArrayIndexOutOfBoundsException: length=2; index=-45812
...

ある時点で ArrayIndexOutOfBoundsException エラーが発生し始めるまで、すべてがうまくいきます...何が起こっているのですか? 値を表示しようとしているときにアプリが System.out でクラッシュしないのはなぜですか? length=2 の唯一の変数は littleBad[] です... drawBitmap メソッドの内部にあるものですか?

4

0 に答える 0