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

Tracking the application's life cycle


In the "safe" MS Windows desktop application development land, our application has a life cycle but it is not so crucial take care of it. Usually, you have a set of events to handle such as FormCreate, FormClose (at the form level), or Application OnRestore, or application OnTerminate. In some cases, you have to handle the state where the main application window is minimized, and this is still simple. In the mobile world, as usual, things are a bit more complex. The concept of life cycle is an evidence. Just to make things messier, the Android activity's life cycle is different from the iOS view life cycle. Remember, when an app is in background, it can be completely destroyed.

Getting ready

But, hey! Why I should care about the life cycle? That's a very good point! There are a lot of things that you should or must do while your application is switching from one state to another.

Here are some examples:

  • Handle current input control's state. You can save...