마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

Bitmap image to file load ... 도와주세요 이미지 파일 저장 너무 느린데 방법좀 알려주세요.

0 추천
05-20 16:54:52.135: E/ViewSystem(10132): ViewRootImpl #2 Surface is not valid.
05-20 16:54:52.135: W/ApplicationPackageManager(10132): getCSCPackageItemText()
05-20 16:54:52.145: I/PersonaManager(10132): getPersonaService() name persona_policy
05-20 16:54:52.175: E/MoreInfoHPW_ViewGroup(10132): Parent view is not a TextView
05-20 16:54:52.205: D/pathme(10132): /storage/emulated/0/tmp_1432108485876.jpg
05-20 16:54:52.375: D/mbitmap(10132): android.graphics.Bitmap@434fcf80
05-20 16:54:53.605: D/dalvikvm(10132): GC_FOR_ALLOC freed 4868K, 27% free 19883K/26908K, paused 18ms, total 18ms
05-20 16:54:53.605: I/dalvikvm-heap(10132): Grow heap (frag case) to 25.472MB for 2359312-byte allocation
05-20 16:54:54.495: D/Path(10132): file:///storage/emulated/0/crop_tmp_1432108485876.jpg
05-20 16:54:54.495: D/Path(10132): /storage/emulated/0/crop_tmp_1432108485876.jpg
05-20 16:54:54.535: W/ApplicationPackageManager(10132): getCSCPackageItemText()
05-20 16:54:54.535: I/PersonaManager(10132): getPersonaService() name persona_policy
05-20 16:54:54.555: E/MoreInfoHPW_ViewGroup(10132): Parent view is not a TextView
05-20 16:54:54.585: D/mImagePath(10132): /storage/emulated/0/crop_tmp_1432108485876.jpg
05-20 16:54:54.585: D/mContentResouve(10132): android.app.ContextImpl$ApplicationContentResolver@42d5dc90
05-20 16:54:54.595: D/dalvikvm(10132): GC_FOR_ALLOC freed 2456K, 26% free 19939K/26908K, paused 13ms, total 14ms
05-20 16:54:54.605: I/dalvikvm-heap(10132): Grow heap (frag case) to 25.527MB for 2359312-byte allocation
05-20 16:54:54.665: D/crop bitmap(10132): android.graphics.Bitmap@435036d8
05-20 16:54:54.665: W/System.err(10132): java.lang.NullPointerException
05-20 16:54:54.665: W/System.err(10132): at com.samsiki.ImageCropActivity.onCreate(ImageCropActivity.java:65)
05-20 16:54:54.665: W/System.err(10132): at android.app.Activity.performCreate(Activity.java:5389)
05-20 16:54:54.665: W/System.err(10132): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
 
    public static File SaveBitmapToFileCache(Bitmap bitmap, String filename) {

    	File fileCacheItem = new File(Environment.getExternalStorageDirectory(),filename);
    	
        OutputStream out = null;
 
        try {
            fileCacheItem.createNewFile();
            out = new FileOutputStream(fileCacheItem);
            bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
            	out.flush();
                out.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return fileCacheItem;
    }

파일 저장 부분 입니다. 뿌려진 비트맵을 가져와 핸드폰에 저장을 하려고 하는데, 저장이 너무 느려서 Null PointException이 뜹니다. 개선방안 좀 알려주세요 ㅠ..ㅠ 이틀째 잡고 있습니다.!

 

ParkYoung (300 포인트) 님이 2015년 5월 20일 질문

1개의 답변

+1 추천
 
채택된 답변
http://www.kmshack.kr/bitmap-outofmemoryerror/

 

위 사이트가 도움되리라 생각됩니다.
taejun (7,240 포인트) 님이 2015년 5월 20일 답변
ParkYoung님이 2015년 5월 22일 채택됨
...