scaling two images to the same or converting bitmap to byte?
mmr.setDataSource(files[i].getPath());
rawArt = mmr.getEmbeddedPicture();//rawart is of type byte
if ( rawArt != null)
{
bitmap2=BitmapFactory.decodeByteArray(rawArt, 0,
rawArt.length, bfo);
bitmap2 = Bitmap.createScaledBitmap(bitmap2, 150,
150, true);
detail.setIcon(bitmap2);//seticon here is of
bitmap type
}else
{ detail.setIcon(R.drawable.ab);//seticon here is of
bitmap type
}
detail is an object of songdetails
in the songdetails i have two functions "setIcon" with different data
types one is int and the other is of bitmap.
what i am doing is if there is an album art attached with a song ,i am
displaying it.(after scaling it to 150X150) if not i am displaying a
default image of type int (stored in drawable-xxhdpi dimensions 270X270)
i used it on an htc phone and the image with dimns. 150X150 is bigger than
of dimns. 270X270(maybe because this image is being rescaled and adjusted
according to the screen size and etc) .but i don't want this.....i want
them to be of the same size (of 150x150). what i have thought is i can
take this image (R.drawable.ab type int) convert it into bitmap and then
rescale it by using this function bitmap2 =
Bitmap.createScaledBitmap(bitmap2, 150, 150, true);
but i don't know how to do it .....thanx in advance..any other solution
will aslo be appreciated.
No comments:
Post a Comment