FMX.AccessCameraApp Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample shows you how to use standard actions to open the camera application, take a picture and retrieve the taken image to display it on your FireMonkey form.

Location

You can find the AccessCameraApp sample project at:

  • Start | Programs | Embarcadero RAD Studio Athens | Samples and then navigate to:
    • Object Pascal\Mobile Snippets\AccessCameraApp
    • CPP\Mobile Snippets\AccessCameraApp
  • Subversion Repository:
    • You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.

Description

The AccessCameraApp sample shows how to use TTakePhotoFromCameraAction to open the camera application on your iOS or Android device, take a picture and retrieve the taken image to display it on your FireMonkey form.

How to Use the Sample

  1. Navigate to one of the locations given above and open:
    • Delphi: AccessCameraApp.dproj.
    • C++: AccessCamera.cbproj.
  2. Select the target platform, iOS and Android supported.
  3. Press F9 or choose Run > Run.
  4. Interact with the sample. Click the camera button to open the camera window and take a picture.

Files

File in Delphi File in C++ Contains

AccessCameraApp.dproj

AccessCamera.cbproj

The project itself.

uMain.fmx

uMain.fmx

The main form where the components are located.

uMain.pas

AccessCameraPCH.h, AccessCamera.cpp

Used to define and implement the sample.

Information.txt

Information.txt

Further information about the sample.

Classes

TAccessCameraAppForm is the main form that represents the main window of the sample. It contains the following components:

Implementation

When you run the aplication, the sample shows a picture and a button with the stylelookup set to cameratoolbuttonbordered. The TTakePhotoFromCameraAction is attached to this button. If you click the button, the camera window is displayed and allows you to choose the camera to be used (front or back) and to take a photo. Once the photo has been taken, the OnDidFinishTaking event assigns the image retrieved from the camera to the TImage component.

Uses

See Also

Samples