Hello,
I need your help
I'm trying to save the settings with the following code
but I get this error: java.lang.ClassCastException:java.lang.String cannot be cast to ...
in this part of the code: WiFiCfg1 = APCfg.Get(i)
how can I fix this?
thanks
I need your help
I'm trying to save the settings with the following code
but I get this error: java.lang.ClassCastException:java.lang.String cannot be cast to ...
in this part of the code: WiFiCfg1 = APCfg.Get(i)
how can I fix this?
thanks
B4X:
Sub Globals
Dim Button_Save As Button
Dim EditText_SSID As EditText
Dim EditText_WiFiKey As EditText
Dim Spinner_Channel As Spinner
Type WiFiCfg(SSID As String,WiFiKey As String,Channel As String)
Dim WiFiCfg1 As WiFiCfg
WiFiCfg1.Initialize
End Sub
Sub SettingsWrite
WiFiCfg1.SSID = EditText_SSID.Text
WiFiCfg1.WiFiKey = EditText_WiFiKey.Text
WiFiCfg1.Channel = Spinner_Channel.SelectedItem
Dim APCfg As List
APCfg.Initialize
APCfg.Add(WiFiCfg1)
File.WriteList(File.DirInternal,"WiFiAPSetings.dat",APCfg)
End Sub
Sub SettingsLoad
If File.Exists(File.DirInternal, "WiFiAPSetings.dat") Then
Dim APCfg As List
APCfg.Initialize
APCfg = File.ReadList(File.DirInternal,"WiFiAPSetings.dat")
Dim i As Int
For i = 0 To APCfg.Size -1
WiFiCfg1 = APCfg.Get(i)
Next
If WiFiCfg1.SSID <> Null Then EditText_SSID.Text = WiFiCfg1.SSID
If WiFiCfg1.WiFiKey <> Null Then EditText_WiFiKey.Text = WiFiCfg1.WiFiKey
End If
End Sub