May 9, 2014 Replies: 2 Very often there is a need to save a few configuration data when exit an app. and to reload them on next start. Like the old Windows INI files ... This library just offers a quick way to do so. The configuration can hold up to 10 entries (10 lines), which can be accessed independently. 10 Entries should be enough for most cases. cfg.Exist just check if a configuration already exist. Important for a first use after installation, when user must first setup some proper values before use the final app .... cfg.Write(ITEM,VALUE) where ITEM is a value from 1-10 cfg.Read(ITEM) just returns the value of ITEM (1-10) Code: Copy If CFG.Exist=True Then hBar1.Value=CFG.Read(1) Else hBar1.Value=150 End If The library is written directly in B4A, sources are included. Have fun G. Attachments CFG_Library.zip CFG_Library.zip 2.7 KB · Views: 530 CFG_Sources.zip CFG_Sources.zip 5.9 KB · Views: 515 Click to expand...
Very often there is a need to save a few configuration data when exit an app. and to reload them on next start. Like the old Windows INI files ... This library just offers a quick way to do so. The configuration can hold up to 10 entries (10 lines), which can be accessed independently. 10 Entries should be enough for most cases. cfg.Exist just check if a configuration already exist. Important for a first use after installation, when user must first setup some proper values before use the final app .... cfg.Write(ITEM,VALUE) where ITEM is a value from 1-10 cfg.Read(ITEM) just returns the value of ITEM (1-10) Code: Copy If CFG.Exist=True Then hBar1.Value=CFG.Read(1) Else hBar1.Value=150 End If The library is written directly in B4A, sources are included. Have fun G.
Erel B4X founder Staff member Licensed User Longtime User May 9, 2014 #2 Note that you can easily create this functionality (and much more) with KeyValueStore class.
GKCS Member Licensed User Longtime User May 9, 2014 #3 Absolutely correct, but for many cases, you neither need the "much more", nor do you need a SQLite based database system to store a few configuration settings .... "KeyValueStore class uses an SQLite database to store and retrieve all kinds of values."
Absolutely correct, but for many cases, you neither need the "much more", nor do you need a SQLite based database system to store a few configuration settings .... "KeyValueStore class uses an SQLite database to store and retrieve all kinds of values."