Does Android support AddHandler?

I am building an Android app which runs OK until I add an AddHandler command:
AddHandler CancelButton.Pressed, AddressOf CancelButtonPressed

It gives the error ‘an internal android compiler error occurred. Please create an issue (…) and attach your project…’.

Shouldn’t Android support AddHandler?

I can’t reproduce it. Works fine here with 2024r1.

Sample Project

Thank you @Martin_T,

As this is a cross-platform app, I have placed the AddHandler inside an external Class, also used by my Desktop, Web and iOS. I have adjusted your app to place the AddHandler code inside a Class that is added to Screen1, and my original error occurs (see app below). This AddHandler-from-a-class technique works for Desktop, Web and iOS.

Can you please confirm it also fails for you when called from the Class. If it fails and you have no other suggestion, I will create a Feedback report.

http://www.holymackerelsoftware.com/Downloads/AddHandler.xojo_binary_project.zip

Yes, I also get the compiler error with your project. I lack a bit of imagination as to why you chose this approach, but that’s not the point here. You should create an issue.

Thanks again @Martin_T, BTW I need the Class to reduce code duplication in my cross-platform apps ie instead of four AddHandlers appearing, one in each of the Opening event of my Desktop, Web, iOS and Android projects, I have one external class to create the AddHandler once for all projects. Multiply this for every AddHandler and my savings are enormous. Plus, it works for Desktop, Web and iOS, so why not Android too?

I have added a Feedback report:
https://tracker.xojo.com/xojoinc/xojo/-/issues/76109

AddHandler works in Android App, I use it.

Unfortunately, the Xojo debugger for Android doesn’t always return the correct error, but sometimes it returns the one you mentioned, leaving us alone.

My problem was that I had changed the name of the class.
from “ContMonth” to “ContMonths”, and I had left the sender with the old name “ContMonth”.
Xojo would try to compile and then give me the same error without giving me any guidance.

For now, with every change to the project, even a very small one, I try to compile, and if Xojo gives me that generic error, the problem is in the last change.

Thank you @Gabriele_Marchionni, maybe the problem is deeper than just my issue, and needs a deeper compiler clean.