Thank you Star-Dust
i have resolved with your second example, but dubt remain.
Why some time the cast work and in other time not?
B4A is based on java. In java sometimes variable casting needs to be clarified, because you can use a variable in different ways.
In this case it's an Object, so you don't identify the variable type. In java to clarify you would write:
MySub (
String Variable). By preceding the type to the variable name (or data) you clearly indicate how you want to understand the data.
Unfortunately in B4A this feature does not exist and therefore to specify that that data is a string (or an integer or float) you have to use different means.
A method for strings is what you have seen, but a general method is like this:
Dim MyString as String = MyGenercObject
CallSub (Name, MyString)
Dim MyInt as Int= MyGenercObject
CallSub (Name, MyInt)
Dim MyDouble as Double= MyGenercObject
CallSub (Name, MyDouble)