Showing posts with label image. Show all posts
Showing posts with label image. Show all posts

Wednesday, 2 May 2012

Image get be zoomed in Android

I had a problem, when I'm using a list of icons and texts in android app, when i press on the list item, the icon must be shown in another activity with size larger than the current(on the list item), when I press back to back to the list activity, i saw the image get zoomed. I solved the issue by creating new object from the current Drawable via the code bellow
Bitmap bitmap = ((BitmapDrawable)listItemIconDrawableObject).getBitmap();   
BitmapDrawable d = new BitmapDrawable(bitmap);
//use d whenever you want


Mohammad Abu Hmead

Tuesday, 3 April 2012

Android Byte Array to Drawble

You can use this method to convert a byte array (which is in the original an image) to Android Drawable


public Drawable getDrwableFromBytes(byte[] imageBytes) {

if (imageBytes != null)
return new BitmapDrawable(BitmapFactory.decodeByteArray(imageBytes,
0, imageBytes.length));
else
return null;
}


Mohammad Abu Hmead