ScratchView icon indicating copy to clipboard operation
ScratchView copied to clipboard

set multiple random background image from drawable -> Exception

Open ghost opened this issue 5 years ago • 1 comments

images randoms:ArrayListOf = [R.drawable.a,R.drawable.b,etc..] R = random.nextInt(2)

Hey, trying to scratch.setBackroundResource(imageRandom[R] but I got a crash ... why?

ghost avatar Jun 23 '20 23:06 ghost

The crash is from your method:

protected void onDraw(Canvas canvas) {

    super.onDraw(canvas);
    canvas.drawBitmap(mScratchBitmap, 0, 0, mBitmapPaint);
    canvas.drawPath(mErasePath, mErasePaint);

}

ghost avatar Jun 23 '20 23:06 ghost