Android Question KeyValueStore error with arrays

tanush62

Member
I don't know what I'm doing wrong. I folowed the example but....

Here is part of my code:
B4X:
    If kvs.IsInitialized = False Then
        Log("init----->")
        Dim kvPath As String
        If File.ExternalWritable = False Then
            kvPath = File.DirInternal
        Else
            kvPath = File.DirDefaultExternal
        End If
        kvs.Initialize(kvPath, "settings")
    End If
        If kvs.GetEncrypted("EncrptedArr", "MyPass") = Null Then
            Dim zpole(7) As String
            zpole = Array As String("00", "192.168.0.0", "roop12", "lato", "zeppelin", "rb123", "fpat")
            kvs.PutEncrypted("EncrptedArr", zpole, "MyPass")
            Dim xort(7) As String
            xort = kvs.GetEncrypted("EncrptedArr", "MyPass")
            
.......

I got errors in last line (line 76 in my code)

error log:
B4X:
Error occurred on line: 76 (Ureg)
java.lang.ClassCastException: java.lang.Object[] cannot be cast to java.lang.String[]
    at com.kaf033.ureg._activity_create(ureg.java:458)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at com.kaf033.ureg.afterFirstLayout(ureg.java:104)
    at com.kaf033.ureg.access$000(ureg.java:17)
    at com.kaf033.ureg$WaitForLayout.run(ureg.java:82)
    at android.os.Handler.handleCallback(Handler.java:754)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:163)
    at android.app.ActivityThread.main(ActivityThread.java:6358)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
** Activity (ureg) Resume **

Please someone help me.
 
Top