[Android] Bitmap (OutOfMemory Exception)
해상도가 큰 파일을 읽어서 Bitmap.createBitmap을 하면 out of memory가 발생합니다.안드로이드 약 2.8메가 이상의 힙메모리 사용시 out of memory가 발생하게 되는데요.이미지를 메모리에 올리지 않고 그 넓이와 높이를 구하는 방법입니다.이것으로 사이즈를 구해서 가능한 현재 화면의 해상도에 맞게 줄여서 사용하셔야 할듯 합니다. public static int getBitmapOfWidth( String fileName ){try {BitmapFactory.Options options = new BitmapFactory.Options();options.inJustDecodeBounds = true;BitmapFactory.decodeFile(fileName, options);r..
Programming/Android
2017. 2. 13. 11:55