public class

PhotoCamera

extends AbsActivityStarter
java.lang.Object
   ↳ sofia.app.internal.AbsActivityStarter
     ↳ sofia.content.PhotoCamera

Class Overview

Allows the user to take a photo using the camera on his or her device.

This class should be used from an event handler in a Screen subclass. Display the camera by calling the start(Activity) method. When a photo is taken and saved, the photoWasTaken method will be called on the screen, if it exists. For example:

 public class MyScreen extends Screen
 {
     public void buttonClicked()
     {
         PhotoCamera camera = new PhotoCamera();
         camera.start(this);
     }
 
     public void photoWasTaken(PhotoCamera camera)
     {
         // Do something with the image by calling camera.getBitmap(),
         // camera.getUri(), or camera.getPath().
     }
 }

Summary

Public Constructors
PhotoCamera()
Initializes a new photo camera.
Public Methods
Bitmap getBitmap()
A convenience method that returns the photo as a Bitmap.
String getPath()
Gets the file system path of the photo that was taken by the camera.
Uri getUri()
Gets the Uri (uniform resource identifier) of the photo that was taken by the camera.
void handleActivityResult(Activity owner, Intent data, int requestCode, int resultCode)
void start(Activity owner, String callback)
Displays the camera application.
void start(Activity owner)
Displays the camera application.
Protected Methods
String getDefaultCallback()
[Expand]
Inherited Methods
From class sofia.app.internal.AbsActivityStarter
From class java.lang.Object

Public Constructors

public PhotoCamera ()

Initializes a new photo camera.

Public Methods

public Bitmap getBitmap ()

A convenience method that returns the photo as a Bitmap.

Returns
  • a Bitmap that represents the photo that was taken

public String getPath ()

Gets the file system path of the photo that was taken by the camera.

Returns
  • the file system path of the photo that was taken

public Uri getUri ()

Gets the Uri (uniform resource identifier) of the photo that was taken by the camera.

Returns
  • the Uri of the photo that was taken

public void handleActivityResult (Activity owner, Intent data, int requestCode, int resultCode)

public void start (Activity owner, String callback)

Displays the camera application. When the user has taken a photo, the owning Activity (or Screen) will have the method with the name specified by method called.

Parameters
owner the activity or screen that owns this photo camera that will receive a notification when a photo is taken

public void start (Activity owner)

Displays the camera application. When the user has taken a photo, the owning Activity (or Screen) will have its photoWasTaken method called.

Parameters
owner the activity or screen that owns this photo camera that will receive a notification when a photo is taken

Protected Methods

protected String getDefaultCallback ()