Java tutorial
//package com.java2s; //License from project: Apache License import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapShader; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Shader.TileMode; public class Main { public static Bitmap getRoundedImage(Bitmap bitmap) { Bitmap circleBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888); BitmapShader shader = new BitmapShader(bitmap, TileMode.CLAMP, TileMode.CLAMP); Paint paint = new Paint(); paint.setShader(shader); Canvas c = new Canvas(circleBitmap); c.drawCircle(bitmap.getWidth() / 2, bitmap.getHeight() / 2, bitmap.getWidth() / 2, paint); return circleBitmap; } public static Bitmap getRoundedImage(Resources res, int resId, float reqWidthInDip, float reqHeightInDip) { //Bitmap bitmap = decodeSampledBitmapFromResource(res, // R.drawable.default_profile, reqWidthInDip, reqHeightInDip); // //return getRoundedImage(bitmap); return null; } }