Class Camera


  extended by Object
      extended by Component
          extended by Camera

public class Camera
extends Component

Camera component shows the camera preview feed and provides the logic to take a snapshot.

See Camera-example.


Constructor Summary
Camera(Style style)
          Creates a new Camera component.
 
Method Summary
 ByteArray capture(List types)
          Takes a photo using phone's camera, with the given format specifications.
 void close()
          Closes camera and release allocated resources.
 boolean isAvailable()
          Checks if the platform supports camera
 
Methods inherited from class Component
add, appendText, clear, find, first, get, getAction, getData, getElement, getFlags, getImage, getLocation, getParent, getShell, getSize, getStyle, getText, getViewPort, hasLinefeed, indexOf, insert, isFocusable, isShown, isVisible, isWrapping, last, operator_get, operator_set, remove, remove, repaint, set, setAction, setData, setElement, setFlags, setImage, setLocation, setPreferredHeight, setPreferredSize, setPreferredWidth, setStyle, setText, size
 
Methods inherited from class Object
toString, equals, hashCode
 
Methods inherited from
equals, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Camera

public Camera(Style style)
Creates a new Camera component.

Parameters:
style - Style to use
Method Detail

isAvailable

public boolean isAvailable()
Checks if the platform supports camera If the camera is unavailable the capture(List) will always return null.


capture

public ByteArray capture(List types)

Takes a photo using phone's camera, with the given format specifications.

Note that it is very likely that phone will ask user's permission to take the photo.

Parameters:
types - List of capture type Strings. When capture is requested by user the system attempts to use the image types contained in list, starting from first and returning the first successful capture. Only required format for Multimedia API is PNG. Type strings examples:
 encoding=png&width=320&height=200
 encoding=jpg&width=160&height=120
 encoding=png
 
Returns:
Byte array containing the captured image, or null if capture failed.

close

public void close()
Closes camera and release allocated resources.