With Erel's guidance (to my error) I got KeyValueStore running. I love it. It works great. I removed all my Save and Update buttons because I don't need them with KVS.
But the problem du jour is spinning my head around.
My projects Main module AppStart initializes the KVS variable and everything works tickety-boo.
Then I launch a new form, closing the Main Form.
I then close the second form and re-Show the MainForm.
That's how I get TO the error.
On the Main Form is a combo box that selects an item stored in the KVS. When I first launch the main form, the value is retrieved and the world is a beautiful place.
However, when I re-Show the Main Form, as soon as I do ANYTHING that calls the KVS, I get a NullPointerException on whatever method of the KVS is being called.
I have tested thoroughly to make sure that the value being passed to the subroutine for action by the KVS is present, has content, and is something that I know for a fact IS in the KVS file.
My experience so far has been the NullPointerException can also mean an object is not initialized. So in the MainForm subroutine that I call to re-Show the Main Form, I added the following:
You will see I am also initializing a dialogue8 object. I had the exact same issue with that object. However, doing the above SOLVED that issue. It has not solved the issue for the KVS object.
Is there a way to undefine an object? I've not yet run across any method that does that, and that may be what I need to do.
However, I'm open to other suggestions about why this is happening.
Thank you all for your time.
But the problem du jour is spinning my head around.
My projects Main module AppStart initializes the KVS variable and everything works tickety-boo.
Then I launch a new form, closing the Main Form.
I then close the second form and re-Show the MainForm.
That's how I get TO the error.
On the Main Form is a combo box that selects an item stored in the KVS. When I first launch the main form, the value is retrieved and the world is a beautiful place.
However, when I re-Show the Main Form, as soon as I do ANYTHING that calls the KVS, I get a NullPointerException on whatever method of the KVS is being called.
I have tested thoroughly to make sure that the value being passed to the subroutine for action by the KVS is present, has content, and is something that I know for a fact IS in the KVS file.
My experience so far has been the NullPointerException can also mean an object is not initialized. So in the MainForm subroutine that I call to re-Show the Main Form, I added the following:
B4X:
dialogue8.Initialize
If kvsRecentItems.IsInitialized = False Then
kvsRecentItems.Initialize(GetDataFolder(strApplicationName), "recentitems.data")
End If
strProjectKVSFilePath = GetDataFolder(strApplicationName)
You will see I am also initializing a dialogue8 object. I had the exact same issue with that object. However, doing the above SOLVED that issue. It has not solved the issue for the KVS object.
Is there a way to undefine an object? I've not yet run across any method that does that, and that may be what I need to do.
However, I'm open to other suggestions about why this is happening.
Thank you all for your time.