Android Question Button control need more tag

dragonguy

Active Member
Licensed User
Longtime User
I create the button, then need to store some info to the button, i use button text to store button name,
button tag to store code1, but i still got 2 code need to tag to button, so how can i make more tag member so i can store all the info.

please help me. Thanks!
 
Create a custom type that store all the info you want to store and save that to the .tag.
 
Upvote 0
how to create custom type? i'm little confuse. i go search many threads also can't find
any related to custom types sample to learn. Please help me.
 
Last edited:
Upvote 0
You can simply create a map with all needed data and put this map to the buttons tag. You can have X Infos inside your Tag with this...

Code: Copy
Dim retmap As Map
retmap.Initialize
retmap.Put("tag","TagValue"&i)
retmap.Put("itemID","ItemID"&i)
retmap.Put("name","ItemName"&i)
retmap.Put("line1","This is line 1")
retmap.Put("line2","This is line 2")
buttonX.Tag = retmap
 
Upvote 0
You can simply create a map with all needed data and put this map to the buttons tag. You can have X Infos inside your Tag with this...

Code: Copy
Dim retmap As Map
retmap.Initialize
retmap.Put("tag","TagValue"&i)
retmap.Put("itemID","ItemID"&i)
retmap.Put("name","ItemName"&i)
retmap.Put("line1","This is line 1")
retmap.Put("line2","This is line 2")
buttonX.Tag = retmap

if i got many button, also can use this way?
after put all the info to the map, how can i read it?
 
Last edited:
Upvote 0
if i got many button, also can use this way?

You must do that for each of your buttons, yes.

after put all the info to the map, how can i read it?

Code: Copy
Sub Button1_Click
    Dim retmap As Map
    retmap.Initialize
    retmap = Button1.Tag
  
    Log(retmap.Get("tag"))
    Log(retmap.Get("itemID"))
    Log(retmap.Get("name"))
    Log(retmap.Get("line1"))
    Log(retmap.Get("line2"))
End Sub
 
Last edited:
Upvote 0
Back
Top