Hi guys,
I tried to use KeyValueStore2 in B4A 9.5
On my service start, this is the codes
On main
On btn_clicked, raised an error
java.lang.NullPointerException
at b4a.example3.keyvaluestore._putencrypted(keyvaluestore.java:421)
Am I missing something here?
I tried to use KeyValueStore2 in B4A 9.5
On my service start, this is the codes
B4X:
Sub Service_Create
Private rp As RuntimePermissions
Main.PUB_InstDir= rp.GetSafeDirDefaultExternal("")
End Sub
Sub Service_Start (StartingIntent As Intent)
Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.
Try
If File.Exists(Main.PUB_InstDir,"kvs.dat") = False Then
Main.kvs.Initialize(Main.PUB_InstDir,"kvs.dat")
Main.kvs.PutEncrypted("RecNo",0,Main.PASSWORD)
End If
Catch
ExitApplication
End Try
End Sub
On main
B4X:
Sub Process_Globals
Public Const PASSWORD As String = "1234567"
Public PUB_InstDir As String
Public kvs As KeyValueStore
End Sub
Sub btn_Clicked
kvs.PutEncrypted("RecNo",1,PASSWORD)
Log(1)
End Sub
On btn_clicked, raised an error
java.lang.NullPointerException
at b4a.example3.keyvaluestore._putencrypted(keyvaluestore.java:421)
Am I missing something here?