Android Question File JSON

T201016

Active Member
Licensed User
Longtime User
Hi,
I am using the following .JSON file for "PreferenceDialog"
and I don't really know what type I have to mention in the .JSON file to be able to distinguish correctly
type "PrefDialog.TYPE_TEXT" from "PrefDialog.TYPE_MULTILINETEXT".
(look at the highlighted line)

I would be very grateful for help in solving this problem.

[CODE lang="b4x" title="File JSON: (see: "type")" highlight="15,26"] Example: template.json
{
"Version": 1.1,
"Theme": "Light Theme",
"Items": [
...
{
"title": "Email",
"type": "Text", --------------------------------- If pi.ItemType = PrefDialog.TYPE_TEXT Then
"key": "Email",
"required": false
},
{
"title": "Description",
"type": "Memo", --------------------------------- If pi.ItemType = PrefDialog.TYPE_MULTILINETEXT Then
"key": "Description",
"required": false
}


Dim sf As Object = PrefDialog.ShowDialog(Item, "OK", Maps.L(23,"CANCEL"))
For i = 0 To PrefDialog.PrefItems.Size - 1
Private pi As B4XPrefItem = PrefDialog.PrefItems.Get(i)
If pi.ItemType = PrefDialog.TYPE_TEXT Then

Else If pi.ItemType = PrefDialog.TYPE_MULTILINETEXT Then

end if
Next[/CODE]
 
?

"type": "Text"
"type": "Multiline Text"

JSON:
{
    "Version": 1.66,
    "Theme": "Dark Theme",
    "Items": [
        {
            "title": "text 1",
            "type": "Text",
            "key": "text",
            "required": false
        },
        {
            "title": "text 2",
            "type": "Multiline Text",
            "key": "textmultiline",
            "required": false
        }
    ]
}

FormBuilder:
1642894491849.png
 
Upvote 1
"type": "Text"
"type": "Multiline Text"
Thank you very much! I used the key without spaces, so far thinking that "MultilineText" is the correct key - with a SPACE!?
 
Upvote 0
Back
Top