Android Question Got Focus for all EditText Views

Guenter Becker

Active Member
Licensed User
Let' say on a layout I have 3 edittext views A,B,C.
In the activity or b4xpage I now I can intercept the fired focus event by sub A_FocusChange(..) a.s.o. Now Let's say I want to show a toast message if one of the edittext views got the focus. Up to now I understand that I have to put the toast show codeline in each of the 3 FocusChanged subs. That works but it blows up the lines of code.

Question: Is it possible (and if yes how to code) to have one sub routine with intercepts all FocusChange Events of all Views type edittext in a layout?

Thank for your help and stay well
Guenter
 

Guenter Becker

Active Member
Licensed User
Hi Klaus,
thank you for your answer but that is what my question goes for.
I tried:
B4X:
sub A_FocusChanged(HasFocus as Boolean)
' this works
end sub

sub EditText_FocusChanged(HasFocus as Boolean)
' this works not.
end sub
How to set the same event name. Could you give a b4a code example .
best regards Günter
 
Last edited:
Upvote 0

Guenter Becker

Active Member
Licensed User
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…