I am making a drawing app such that user can choose to load pictures from the gallery and further draw on it. However, if the size of the photo is greater than the screen, it can only show part of the picture.
public void load_pic(String picturePath) // load a picture from gallery
{
bitmap = (BitmapFactory.decodeFile(picturePath)).copy(Bitmap.Config.ARGB_8888, true);
bitmapCanvas = new Canvas(bitmap);
invalidate();
}
How could i code such that the picture can either
- load in such that can fit either maximium allowable screen width or height, or
- load in such that can pull the image to occupy the full screen
Also, running on some device it would give out java.lang.OutOfMemoryError...and it crashed...How could that be tackled?
Many thanks in advance!!