Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Matrix; public class Main { public final static Bitmap rotationBitmap(Bitmap srcBitmap, float degrees) { Bitmap result = null; if (degrees != 0 && srcBitmap != null) { Matrix m = new Matrix(); m.setRotate(degrees, (float) srcBitmap.getWidth() / 2, (float) srcBitmap.getHeight() / 2); try { Bitmap b2 = Bitmap.createBitmap(srcBitmap, 0, 0, srcBitmap.getWidth(), srcBitmap.getHeight(), m, true); if (srcBitmap != b2) { srcBitmap.recycle(); srcBitmap = b2; } result = b2; } catch (OutOfMemoryError ex) { ex.printStackTrace(); } } return result; } }