I'm trying to implement Bitmap memeCanvas = BitmapFactory.decodeResource(getResources(), xxx).copy(Bitmap.Config.ARGB_8888, true);
to draw on the images that I upload from my phone to my ImageView
. Because I don't have a specific drawable path like R.drawable.hypotheticalImage
, I don't know how to pass the same information for a drawable path that is dynamic as the 2nd parameter of BitmapFactory.decodeResource()
.
I can supply code per request.
This is my solution. I had to call getContext()
to be able to access getContentResolver()
and wrap the entire thing in a try-catch block.
Bitmap memeCanvas = null;
try {
memeCanvas = BitmapFactory
.decodeStream(getContext()
.getContentResolver()
.openInputStream(imageUri))
.copy(Bitmap.Config.ARGB_8888, true);
} catch (FileNotFoundException e) {
e.printStackTrace();
}