B4J Question Loading Custom Type From KeyValueStore From Second App

cklester

Well-Known Member
Licensed User
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:


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.
 

cklester

Well-Known Member
Licensed User
Make sure to do it in both apps.

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

DonManfred

Expert
Licensed User
Longtime User
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?
- 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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…