Android Question [SOLVED] Problem writing EditText.Text to Map

GMan

Well-Known Member
Licensed User
I want to write 2 simple entries in a map:
B4X:
    If Mappi.IsInitialized = True Then
        EditTextName.InputType = EditTextName.Text
        EditTextemail.InputType = EditTextemail.Text
        Mappi.Put("vornachname",EditTextName.Text)
        Mappi.Put("emailadresse",EditTextemail.Text)
        For Each v As Int In Mappi.Values
            Log(v)
        Next
        File.WriteMap(share & "/testdir","userdata.map",Mappi)
    End If
But i get following error when saving the map:
B4X:
java.lang.NumberFormatException: Invalid double: "John Smith"
The Input_Type is TEXT....
 

GMan

Well-Known Member
Licensed User
Tried it with your code, but same error

I also removed the log-part completely - same error

As long as i use integers all works fine o_O
 

GMan

Well-Known Member
Licensed User
This does the Trick (even the EditText-fields are marked as TEXT)

B4X:
EditTextName.InputType = EditTextName.INPUT_TYPE_TEXT
EditTextemail.InputType = EditTextemail.INPUT_TYPE_TEXT
But only when SAVING.

When reading the map with this code:

B4X:
        Mappi = File.ReadMap(share & "/testdir","userdata.map")

            EditTextName.InputType = EditTextName.INPUT_TYPE_TEXT
            EditTextemail.InputType = EditTextemail.INPUT_TYPE_TEXT
            EditTextName.Text = Mappi.Get("vornachname")
            EditTextemail.Text = Mappi.Get("emailadresse")
the same error appears
 
Last edited:

GMan

Well-Known Member
Licensed User
Solved - THIS works

B4X:
            Mappi = File.ReadMap(share & "/testdir","userdata.map")
            Panel5.Visible=True
            EditTextName.InputType = EditTextName.INPUT_TYPE_TEXT
            EditTextemail.InputType = EditTextemail.INPUT_TYPE_TEXT
            EditTextName.Text = Mappi.Get("vornachname")
            EditTextemail.Text = Mappi.Get("emailadresse")
This NOT:
B4X:
          Mappi = File.ReadMap(share & "/testdir","userdata.map")
 
            EditTextName.InputType = EditTextName.INPUT_TYPE_TEXT
            EditTextemail.InputType = EditTextemail.INPUT_TYPE_TEXT
            EditTextName.Text = Mappi.Get("vornachname")
            EditTextemail.Text = Mappi.Get("emailadresse")
           Panel5.Visible=True
The only difference ist, that in the working solution the Panel5 is made Visible BEFORE getting the values.

Don't know why.....:confused:
 
Top