public static Bitmap rotate(Bitmap b, int degrees) { if ( degrees != 0 && b != null ) { Matrix m = new Matrix(); m.setRotate( degrees, (float) b.getWidth() / 2, (float) b.getHeight() / 2 ); try { Bitmap b2 = Bitmap.createBitmap( b, 0, 0, b.getWidth(), b.getHeight(), m, true ); if (b != b2) { b.recycle(); b = b2; } } catch (OutOfMemoryError ex) { // We have no memory to rotate. Return the original bitmap. } } return b; }
위의 코드를 참조해보세요.
모르는 점이 있어서 비트맵을 회전시키는것을 하다가 자꾸 에러가 떠서...
보니 비트맵 recycle은 Activity.onDestroy에서만 해야지.. 오류를 안뿜떠군요... 그냥 b=null;로처리하면 좋을것 같습니다 혹시 몰라 답변들 남깁니다 ^^
참조 : http://namghiwook.wordpress.com/2012/02/10/bitmap-recycle-%EC%9D%80-activity-ondestroy-%EC%97%90%EC%84%9C%EB%A7%8C-%ED%95%B4%EB%9D%BC/
로그인 유지
위의 코드를 참조해보세요.