HERE Android SDK Developer's Guide

Image

The class Image is a member of com.here.android.mpa.common .

Class Summary

public final class Image

extends java.lang.Object

Encapsulates an image file.

[For complete information, see the section Class Details]

Nested Class Summary

Table 1. Nested Classes in Image
Nested Classes

public static final enumeration Image.Type

This helps the application know the base type of the Image .

Constructor Summary

Table 2. Constructors in Image
Constructors

Image ()

Method Summary

Table 3. Methods in Image
Methods

public Bitmap getBitmap ()

Creates an android.graphics.Bitmap from this Image if the type is BITMAP, null otherwise.

public long getHeight ()

Gets the current height of the Image , in pixels.

public Type getType ()

Gets the file type of this Image.

public long getWidth ()

Gets the current width of the Image , in pixels.

public boolean isValid ()

Determines whether the Image object contains a valid image.

public boolean setBitmap (Bitmap bitmap)

Sets a Bitmap for the Image .

public void setImageAsset (String assetName)

Sets Image data by an image in the assets directory.

public void setImageData (byte[] bytes)

Sets an array of byte data for the Image .

public void setImageFile (String fileName)

Sets Image data by an image file located in the internal storage.

public void setImageResource (int id)

Sets data for the Image by way of an application's resource.

public void setLocalUrl (String localUrl)

Sets a local URL that the Image can access for an image.

Class Details

Encapsulates an image file.

Note: although BMP, JPEG and PNG data formats are supported, only basic parsing of a BMP header is done (gamma correction and color profile information are ignored), and supported BMP data formats are limited to:

  • BMP v3 (standard BMP) with 24/32 bits per pixel without compression
  • BMP v4/v5 (newer BMP formats) with 24/32 bits per pixel, bit fields compression and A8R8G8B8 pixel format

Constructor Details

Image ()

Method Details

public Bitmap getBitmap ()

Creates an android.graphics.Bitmap from this Image if the type is BITMAP, null otherwise.

Returns:

An android.graphics.Bitmap or null if this Image is not BITMAP.

public long getHeight ()

Gets the current height of the Image , in pixels.

Returns:

The current height

public Type getType ()

Gets the file type of this Image.

Returns:

The Image.Type for this Image object.

public long getWidth ()

Gets the current width of the Image , in pixels.

Returns:

The current width

public boolean isValid ()

Determines whether the Image object contains a valid image.

Returns:

True if the Image object is valid and can render an image, false otherwise

public boolean setBitmap (Bitmap bitmap)

Sets a Bitmap for the Image .

Parameters:

  • bitmap

    A Bitmap to be used by the Image

Returns:

True if the Bitmap is set successfully, false otherwise

public void setImageAsset (String assetName)

Sets Image data by an image in the assets directory. In particular, this calls openFileInput(String).

Parameters:

  • assetName

    The name of an image in the assets directory.

Throws:

  • IOException

    on failure to read the resource.

public void setImageData (byte[] bytes)

Sets an array of byte data for the Image .

Note: JPEG and BMP are supported.

Parameters:

  • bytes

    An array of byte data containing the Image

public void setImageFile (String fileName)

Sets Image data by an image file located in the internal storage. In particular, this calls openFileInput(String).

Parameters:

  • fileName

    The name of the image file.

Throws:

  • IOException

    On failure to read the resource.

public void setImageResource (int id)

Sets data for the Image by way of an application's resource.

Parameters:

  • id

    An ID for the resource

Throws:

  • IOException

    Upon a failure to read the resource.

public void setLocalUrl (String localUrl)

Sets a local URL that the Image can access for an image.

Parameters:

  • localUrl

    The local URL that the Image uses

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.