Android Question Custom View Event

stevenindon

Active Member
Licensed User
Hello all,

I am creating a Customview and currently i raise Customview event as such :

B4X:
#Event: UserClick(svalue1 as String,svalue2 as String)
...
...
...
CallSub3(mCallBack, mEventName & "_" & "UserClick","Steven","32")  '<<--- Calling of Event

How can i raise an event with more data? Example :
CallSub3(mCallBack, mEventName & "_" & "UserClick","Steven","32","Male","North")

CallSub 3 limits only to 2 parameters. Please help....
 

LucaMs

Expert
Licensed User
Longtime User
(I'm waking up in these minutes ) Another, perhaps better, way is to pass a custom type variable. This way has the advantage that you don't have to remember the Map keys, the editor will show you every data field.
It also has another advantage, compared to Maps: writing (hard-coding) string keys of a Map, as well as having to remember them (unless you create a nice module that simulates an Enum - I love Enums!) you risk typing them wrong; this cannot happen with a custom type.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…