Use the following method to get thumbnails.
This method is useful if you have an Image Path.
public static Bitmap createThumb(String selectedImagePath, int thumbWidth,
int thumbHeight) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(selectedImagePath, options);
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > thumbHeight || width > thumbWidth) {
if (width > height) {
inSampleSize = Math.round((float) height / (float) thumbHeight);
} else {
inSampleSize = Math.round((float) width / (float) thumbWidth);
}
}
options.inJustDecodeBounds = false;
options.inSampleSize = inSampleSize;
return BitmapFactory.decodeFile(selectedImagePath, options);
}
To use this method,
createThumb("path of image",100,100);
Edit
This method is used when you have a Bitmap image of your image.
public static Bitmap createThumb(Bitmap sourceBitmap, int thumbWidth,int thumbHeight) {
return Bitmap.createScaledBitmap(sourceBitmap, thumbWidth, thumbHeight,true);
}
to use this method
createThumb(editedImage, 100, 100);