FMX.CameraRoll Sample

From Appmethod Code Examples
Jump to: navigation, search

This sample demonstrates how to use TTakePhotoFromLibraryAction to open the Photo Library on your iOS or Android device, retrieve an image from the library and display it on your FireMonkey form.

Location

You can find the AccessCameraApp sample project at:

Description

The CameraRoll sample shows how to use media library actions to take photos from the local library of your iOS or Android device. The sample uses the TTakePhotoFromLibrary action to open the Photo Library of your device. Then, you can choose a photo from the library in order to be displayed on your FireMonkey form.

How to Use the Sample

  1. Navigate to one of the locations given above and open:
    • Object Pascal: 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 library button to open the Photo Library of your device.
    • Select a photo.
    • See the photo displayed in your FireMonkey form.

Files

File in Object Pascal File in C++ Contains

CameraRoll.dproj

CameraRoll.cbproj

The project itself.

uMain.fmx

uMain.fmx

The main form where the components are located.

uMain.pas

CameraRollPCH.h, CameraRoll.cpp

Used to define and implement the sample.

Information.txt

Information.txt

Further information about the sample.

Classes

TCameraRollForm 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 button at the upper right corner with the stylelookup set to organizetoolbuttonbordered. The TTakePhotoFromLibrary action is attached to this button. If you click the button, the Photo Library opens and allows you to choose a photo. Once the photo has been chosen, the OnDidFinishTaking event assigns the image retrieved from the library to the TImage component in order to be displayed on your FireMonkey form.

Uses

See Also

Samples

Personal tools