Android Question B4XPreferencesDialog initial values

HAH

Active Member
Licensed User
Hello
This code I creating item programmatically:
B4X:
prefdialog.AddTextItem("key","title")
How to programmatically initialize a default value?
How to programmatically set it as mandatory or optional field?

Thank you
 

Erel

Administrator
Staff member
Licensed User
How to programmatically initialize a default value?
Default values are always set programmatically.
Read the tutorial: https://www.b4x.com/android/forum/threads/b4x-b4xpreferencesdialog-cross-platform-forms.103842/
It is explained. It is also shown in the example.

How to programmatically set it as mandatory or optional field?
Why are you creating the template programmatically? You can get the items from PrefItems list and modify them.
 

HAH

Active Member
Licensed User
Yes, I got it, I should call createmap and assign it to option before prefdialog.ShowDialog
B4X:
Options=CreateMap("key1":"value1","key2":"value2")
And to set any field mandatory It is better to call LoadFromJson, it is simpler and quick

Thank you @Erel
 
Top