CallSubDelayed2(Activity2, "SomeSub", CreateMap ("color": Colors.Red, "width": 200))
Public Sub SomeSub (Params As Map) Dim clr As Int = Params.Get("color") End Sub
Interesting, that would be good for many of my applications.No one likes the classes.
I understand that in some cases it's easier to use a Map (I love the Maps) or an array, but... there is little talk of classes, in this site.
Yet, "severl values", often means a precise object.
(A little bit off topic, I know; but at least I'll add a post in which you talk about classes )
Looks possible in a single activity though where different instances of the same class can be passed as parameters to a sub. From a quick timing check it looks like it is by reference.you cannot pass a reference to an class-instance to another activity. Each activity can - or need to use - an own instance of the class.
Classes are not a good idea here to pass values from activity A to B
Yes, that's was the error in Test 1, but my comments about "other languages" concerns classes/objects.I think that all languages treat arrays as arrays and non-arrays as non-arrays.
Your code is wrong. You shouldn't pass an array if the sub expects a non-array parameter.
Public Sub SetMyClassObject(MyClassObject As Object) ' <--- this does not work 'Public Sub SetMyClassObject(MyClassObject As MyClass) ' <--- this does not work Dim MyObject As MyClass = MyClassObject Log(MyObject.Name) End Sub Public Sub SetLocale(Loc As AHLocale) ' <--- this works, Loc is an object Log(Loc.Country) End Sub
I had already fixed the error (array) in the project attached in #12.Works here fine after I fixed your code and removed the array.
Public Sub SetMyClassObject(MyClassObject As Object) ' <--- this does not work 'Public Sub SetMyClassObject(MyClassObject As MyClass) ' <--- this does not work Dim MyObject As MyClass = MyClassObject Log(MyObject.Name) End Sub