Android Question B4XPreferencesDialog initial values

Discussion in 'Android Questions' started by HAH, Jun 20, 2019.

  1. HAH

    HAH Active Member Licensed User

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

    Thank you
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    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.

    Why are you creating the template programmatically? You can get the items from PrefItems list and modify them.
     
  3. HAH

    HAH Active Member Licensed User

    Yes, I got it, I should call createmap and assign it to option before prefdialog.ShowDialog
    Code:
    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
     
    Erel likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice