Android Question B4XPreferencesDialog initial values

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime 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

B4X founder
Staff member
Licensed User
Longtime 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.
 
Upvote 0

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime 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
 
Upvote 0
Top