duplicate 'type' declaration

mc73

Well-Known Member
Licensed User
Longtime User
I had a type set to two modules, with identical name. Everything was working great. I cannot remember the error I was getting and what was my b4a version then, but I had to declare the second type using a different name.
After upgrading to the latest b4a version, I've noticed a problem with casting. I was sending with callSub2 the type from one activity module to the other. Though they had identical components, the error was there. Now, removing one type from the second activity, and renaming it to its original name, everything is running smooth again. So far, so good, I think that with this b4a version types are declared globally. Yet, I still wonder if there is a deeper reason for the casting error with the two types of identical components. Any help would be appreciated.
 

thedesolatesoul

Expert
Licensed User
Longtime User
As far as I remember (since 1.5) types have always been global.
Casting two types with identical components (does not make complete sense to me), but you can create a sub that assigns one type to the other (component by component).
I only saw these casting errors when reading back from a file, if I wrote with a different type. I think if you add a new field there is no problem, but if you rename a field or the type name it throws a classcastexception.
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
I had two different identical types because I ignored the fact that types are global :)
Anyway, I think everything is clear now, even if I cannot remember the error that led me to change names.
 
Upvote 0
Top