cklester Well-Known Member Licensed User Jan 11, 2023 #1 I have an app which creates a KeyValueStore with one of the key-values a list of custom types. Shouldn't I be able to use that same KVS and load the custom types in a second app? I can't seem to make it work. I'm including the same type definition in the second app, but receiving this error when trying to load it back: Waiting for debugger to connect... Program started. Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events. Error occurred on line: 25 (KeyValueStore) java.lang.RuntimeException: java.lang.ClassNotFoundException: b4j.example.coinapi$_symbol Click to expand... I've tried putting the custom type def in "Main" and "B4XMainPage," but neither works. Can I not load a custom type from a KVS from a second app? ADDED: Yes, I searched. None of the solutions worked for me.
I have an app which creates a KeyValueStore with one of the key-values a list of custom types. Shouldn't I be able to use that same KVS and load the custom types in a second app? I can't seem to make it work. I'm including the same type definition in the second app, but receiving this error when trying to load it back: Waiting for debugger to connect... Program started. Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events. Error occurred on line: 25 (KeyValueStore) java.lang.RuntimeException: java.lang.ClassNotFoundException: b4j.example.coinapi$_symbol Click to expand... I've tried putting the custom type def in "Main" and "B4XMainPage," but neither works. Can I not load a custom type from a KVS from a second app? ADDED: Yes, I searched. None of the solutions worked for me.
Erel B4X founder Staff member Licensed User Longtime User Jan 12, 2023 #2 cklester said: Can I not load a custom type from a KVS from a second app? Click to expand... You can. cklester said: I've tried putting the custom type def in "Main" and "B4XMainPage," but neither works. Click to expand... Make sure to do it in both apps. Upvote 0
cklester said: Can I not load a custom type from a KVS from a second app? Click to expand... You can. cklester said: I've tried putting the custom type def in "Main" and "B4XMainPage," but neither works. Click to expand... Make sure to do it in both apps.
cklester Well-Known Member Licensed User Jan 12, 2023 #3 Erel said: Make sure to do it in both apps. Click to expand... I checked on this. In app 1, the custom type definition is actually in a class module that is neither Main nor B4XMainPage. When I move it from the class module to Main, it now gives me the same error as I'm getting from app 2. I have a 21MB KeyValueStore with this data. Am I going to have to rebuild that database if I want to be able to use it from app 2? I thought custom Type()s were global regardless of where defined. Seem I was wrong. Do they have to be defined in Main or B4XMainPage? Upvote 0
Erel said: Make sure to do it in both apps. Click to expand... I checked on this. In app 1, the custom type definition is actually in a class module that is neither Main nor B4XMainPage. When I move it from the class module to Main, it now gives me the same error as I'm getting from app 2. I have a 21MB KeyValueStore with this data. Am I going to have to rebuild that database if I want to be able to use it from app 2? I thought custom Type()s were global regardless of where defined. Seem I was wrong. Do they have to be defined in Main or B4XMainPage?
DonManfred Expert Licensed User Longtime User Jan 13, 2023 #4 cklester said: I have a 21MB KeyValueStore with this data. Am I going to have to rebuild that database if I want to be able to use it from app 2? Click to expand... - The CustomTYPEs must be in main when you write them to the kvs. - The CustomTYPEs must be in main in your 2nd App when you want to read the KVS. I fear you have to rebuild the kvs. Upvote 0
cklester said: I have a 21MB KeyValueStore with this data. Am I going to have to rebuild that database if I want to be able to use it from app 2? Click to expand... - The CustomTYPEs must be in main when you write them to the kvs. - The CustomTYPEs must be in main in your 2nd App when you want to read the KVS. I fear you have to rebuild the kvs.