Code example for Bitmap

Methods: createBitmapgetHeightgetWidthrecycleequals

0
	} 
	 
	public static Bitmap getRotatedBitmap(Bitmap bitmap, int degrees)	{
	    if ( degrees != 0 && bitmap != null ) {
	        Matrix m = new Matrix();
	        m.setRotate(degrees, (float) bitmap.getWidth() / 2, (float) bitmap.getHeight() / 2 );
	        try { 
	            Bitmap b2 = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true);
	            if (bitmap.equals(b2)){
	            	bitmap.recycle();
	            	bitmap = b2;
	            } 
	        }  
	        catch (OutOfMemoryError ex){
	        	// TODO Auto-generated catch block 
	        	ex.printStackTrace();
	        } 
	    } 
	    return bitmap;
	} 
Contextual code suggestions in your IDE  Get Codota for Java