public class

ImageUtils

extends Object
java.lang.Object
   ↳ com.urbanairship.util.ImageUtils

Class Overview

A class containing utility methods related to bitmaps.

Summary

Nested Classes
class ImageUtils.DrawableResult Drawable result. 
Public Constructors
ImageUtils()
Public Methods
static int calculateInSampleSize(int width, int height, int reqWidth, int reqHeight)
Calculate the largest inSampleSize value that is a power of 2 and keeps both height and width larger than the requested height and width.
static Bitmap fetchScaledBitmap(Context context, URL url, int reqWidth, int reqHeight)
Create a scaled bitmap.
static ImageUtils.DrawableResult fetchScaledDrawable(Context context, URL url, int reqWidth, int reqHeight)
Fetches a drawable from an image path.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ImageUtils ()

Public Methods

public static int calculateInSampleSize (int width, int height, int reqWidth, int reqHeight)

Calculate the largest inSampleSize value that is a power of 2 and keeps both height and width larger than the requested height and width.

Taken from http://developer.android.com/training/displaying-bitmaps/load-bitmap.html.

Parameters
width The width of the image.
height The height of the image.
reqWidth The requested width of the image.
reqHeight The requested height of the image.
Returns
  • The calculated inSampleSize.

public static Bitmap fetchScaledBitmap (Context context, URL url, int reqWidth, int reqHeight)

Create a scaled bitmap.

Parameters
context The application context.
url The URL image.
reqWidth The requested width of the image.
reqHeight The requested height of the image.
Returns
  • The scaled bitmap.
Throws
IOException if file fails to be created.

public static ImageUtils.DrawableResult fetchScaledDrawable (Context context, URL url, int reqWidth, int reqHeight)

Fetches a drawable from an image path.

Parameters
context The application context.
url The URL.
reqWidth The requested width of the image.
reqHeight The requested height of the image.
Returns
  • The result or null if the file was unable to be downloaded.
Throws
IOException if file fails to be created.