friends
I am using the following code for resizeImage
private Bitmap resizeImage( final Bitmap image) {
Bitmap resizedImage = null;
if(image != null)
{
int maxHeight = 80;
int maxWidth = 150;
int imageHeight = image.getHeight();
if ( imageHeight > maxHeight )
imageHeight = maxHeight;
int imageWidth = (imageHeight*image.getWidth()) / image.getHeight();
if ( imageWidth > maxWidth ) {
imageWidth = maxWidth;
imageHeight = (imageWidth*image.getHeight()) / image.getWidth();
}
resizedImage = Bitmap.createScaledBitmap( image, imageWidth, imageHeight, true);
}
return resizedImage;
}
from the Internet. now it works fine on a high resolution screen, but on a small screen no one tells me what should I do to display an image in accordance with the screen resolution?
source
share