Android Question Problem with Tags and Maps (collections)

Discussion in 'Android Questions' started by FrankBerra, May 13, 2019.

  1. FrankBerra

    FrankBerra Active Member Licensed User

    Hello forum
    I was used to use tags in custom views like this
    Code:
    Public Sub setTag1(ValoreTag1 As Object)
       Tag1 = ValoreTag1
    End Sub

    Public Sub getTag1 As Object
       
    Return Tag1
    End Sub
    Until now i was setting tags with simple strings and everything worked as expected.
    Now i need to set a map (collection) as tag.
    I set it with:
    Code:
    dim m as map
    m.initialize
    m.put(
    "x""123")
    CLV.Tag1 = m
    but when i retrieve the tag with
    Code:
    Sub Generic
    dim m as map
    m = CLV.Tag1

    CallSubDelayed2(Me, 
    "Elaborate", m)
    End sub

    Sub Elaborate(Values as map)  '<--- Error here

    End Sub
    i expect to get a map but when use it, an error says to me that:
    Code:
    argument 1 has type anywheresoftware.b4a.objects.collections.Map, got anywheresoftware.b4a.objects.collections.Map$MyMap
    Where i am wrong?
     
  2. DonManfred

    DonManfred Expert Licensed User

    Try it this way
    Code:
    Sub Elaborate(Values as Object)
    dim m as map = Values

    End Sub
     
    Erel and Peter Simpson like this.
  3. FrankBerra

    FrankBerra Active Member Licensed User

    It works, thank you!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice