Francois Piette on his blog “Behind the connection” writes about how to create your own custom TIniFile class for your Delphi Android and Windows Firemoneky applications. He describes how to model a custom class using the SharedPreferences API to make INiFiles work on both the Android and windows platforms. Typically with Windows applications, the INI file format is a simple text file with a Key/Value pairs and all the related pairs related grouped into a a section. With an Android application, there is no concept of a section. Therefore, to create the section concept, Francois simply prefixes each key by its section name surrounded by brackets like this: ‘[‘ + Section + ‘]_’ + Key. In addition, Delphi has a class encapsulation of the Windows INI files (TIniFile) which resides in the “System.IniFiles unit”. Francois uses the same class name in his implementation and even the same class signature by inheriting from the existing TCustomIniFile for Android and TInifFile for Windows. However, instead of using “System.IniFiles”, he uses “FMX.Overbyte.IniFiles” in the uses clause. Stop on over and read Francois’s article and find out how he handles file storage location and see his example code. While you are there, you can download the full source code of his custom class and demo.
1 Comment