Book Image

Delphi Cookbook

By : Daniele Teti
Book Image

Delphi Cookbook

By: Daniele Teti

Overview of this book

Table of Contents (14 chapters)
Delphi Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using Android SDK Java classes


In this recipe, we'll talk about the mechanisms that the compiler offers to import classes from the Android SDK and NDK. This is not a standard recipe, but is more of a showcase of the possibilities offered by the Delphi compiler, and the processes needed to fully use them when dealing with built-in libraries of the OS.

Getting ready

What we'll do is import a well-known Android class used everywhere in the Android ecosystem—Toast. The Android documentation states the following:

"A toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message and the current activity remains visible and interactive. For example, navigating away from an email before you send it triggers a "Draft saved" toast to let you know that you can continue editing later. Toasts automatically disappear after a timeout."

So, how do we use a Toast in a Delphi app?

The first thing to do is have a clear vision of the class methods...