Resize Drawable Image


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  1. ////////////////////////////////////////////////////
  2. //resize drawable image
  3. ////////////////////////////////////////////////////
  4. public Drawable resize(Drawable image, int theWidth, int theHeight) {
  5. BT_debugger.showIt(activityName + ": method resize called");
  6. BT_debugger.showIt(activityName + ": image resize method " + image.getBounds() + " --> " + theWidth + " x " + theHeight);
  7. Bitmap d = ((BitmapDrawable)image).getBitmap();
  8. Bitmap bitmapOrig = Bitmap.createScaledBitmap(d, theWidth, theHeight, false);
  9. return new BitmapDrawable(bitmapOrig);
  10. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.