And there,
I'm trying to use EditText1.Text as the Key in a Map. So that different names entered into EditText1 return different Values.
The For loop works of course:
How would it be done using EditText1.Text as the Key?
And the Value returned be used as a variable:
Imageview1.Bitmap = LoadBitmap(File.DirAssets, $"${Value}. jpg"$)
Thanks in advance.
I'm trying to use EditText1.Text as the Key in a Map. So that different names entered into EditText1 return different Values.
The For loop works of course:
B4X:
Sub EditText12_EnterPressed ' this works as EditText1
Dim Map1 As Map = CreateMap("alan": 1, "robert": 2, "tony": 3)
For Each key As String In Map1.Keys
Log ("Key: " & key)
Log ("Value: " & Map1.Get(key))
Next
End Sub
B4X:
Sub EditText1_EnterPressed
Dim Map1 As Map = CreateMap("alan": 1, "robert": 2, "tony": 3)
Dim mapNme = EditText1.Text As String ' "Invalid double" error
' Dim mapNme = EditText1.Text As Int ' "Invalid double" error
' Log(Map1.GetValueAt(mapNme))
' Log(Map1.GetValueAt(tony))
Log("Value: " & Map1.GetValueAt(mapNme))
End Sub
Imageview1.Bitmap = LoadBitmap(File.DirAssets, $"${Value}. jpg"$)
Thanks in advance.
Attachments
Last edited: