I'm following this S.O. post about how to crop an image using a Bitmap.
As confirmed in Android documentation, there is a method createBitmap() that has the following parameters:
createBitmap(Bitmap source, int x, int y, int width, int height)
But I don't understand what this Bitmap source needs to be. I believe it must refer to the image I wish to use for my Bitmap object. The image I wish to use is stored as a drawable named rainbow, so I tried the following:
Bitmap cropedBitmap = Bitmap.createBitmap(R.id.rainbow, 0, 0, 300, 300);
In which case Android Studio reports "Cannot resolve symbol 'rainbow'
I also tried:
Bitmap cropedBitmap = Bitmap.createBitmap(R.drawable.rainbow, 0, 0, 300, 300);
and Android Studio reports "Cannot resolve method createBitmap(int, int, int, int, int)
I see from the documentation that the first parameter is a Bitmap. Wouldn't that be using a Bitmap to create a Bitmap? Also I don't see any constructors for the Bitmap class on its documentation page.
Any suggestions on what I'm missing or what to try next?