Starting an activity for a result – the SpeechToText engine

Sometimes, you want to get a result back from an activity when it ends its job. For example, you may start an activity that lets the user pick a photo in a photo gallery and when it ends, it returns the selected image or a person in a list of contacts and when it ends, it returns the person that was selected.

To do this, we call the TAndroidHelper.Activity.startActivityForResult method. The result will come back through a FireMonkey message readable using the global TMessageManager instance.

The startActivityForResult property gets two parameters: the first one is the intent itself, while the second is an integer value identifying the request code. This request code will be passed ...

Get Delphi Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.