Author: Developer Skill Sprints
Table of Contents
Introduction to “SaveState”
- Persist form & app state between sessions
- On mobile devices, background apps may be terminated for memory
- Default saves state to transient / temporary storage
- Also option to save to persistent storage
TFormSaveState
- FireMonkey TForm and TForm3D
- SaveState: TFormSaveState property
- OnSaveState: TNotifyEvent event
- TFormSaveState.Stream: TMemoryStream
- Stream to load and save state from
- TFormSaveState.StoragePath: String
- Location persisted too (default is temporary path)
- TFormSaveState.Name: String
- Customize persistence file name (allows for multiple files)
Platform Behaviors for SaveState
- Android
- Transient is stored in the native activity
- Transient state lost if app terminated manually
- Test with “Developer Options” → “Don’t keep activities”
- iOS, Windows, OS X
- Still persisted when app manually terminated
- Windows & OS X
- Default location is shared temp folder
More information
- Working with FireMonkey Save State
- OnSaveSate event
- TFormSaveState
- Daniele Spinetti’s SaveState Helper
Samples
Replays
Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition