Cannot Extend Mojo.app on android.
Monkey Forums/Monkey Bug Reports/Cannot Extend Mojo.app on android.
| ||
Hi all, When you try to extends the class mojo.app with your own app class. It works everywhere (HTML5/IOS) but not on android because the java version of the mojo.app has the "final" keyword associated to it => you cannot extend it. |
| ||
What are you trying to do? Can you show us some code? |
| ||
Hi therevills, I was playing around with the bono module (found in the module registry). This module extends the mojo app like this : Class App Extends app.App Abstract ... End You can see the entire file here : https://github.com/michaelcontento/bono/blob/master/src/kernel/app.monkey When I tried to compile the minimal sample for android target, I gor a compile error because the mojo.app is declared with the final keyword. The minimal sample code was found in the readme : Import bono Import mojo Class MyApp Extends bono.App Method Run:Void() GetDirector().AddScene("menu", New MenuScene()) GetDirector().GotoScene("menu") End End Class MenuScene Extends Scene Method OnRender:Void() DrawText("Hello World", 100, 100) End End Function Main:Int() New MyApp() Return 0 End Thanks |
| ||
Hmmm, that's a bit strange. In the Diddy Framework we do something similar and we don't have that issue:Class DiddyApp Extends App https://github.com/swoolcock/diddy/blob/master/src/diddy/framework.monkey Can you alter the bono.app so it doesn't have the Abstract keyword? |
| ||
Yep Strange. In fact, you are not doing exactly the same thing. You use another name for your app (DiddyApp) Class DiddyApp Extends App What Bono tries to do is using the exact same name (App) playing only with the 'namespace' Class App Extends app.App When, I change Bono to use another name (for example bonoApp) it works !! As It works on IOS and HTML5, there may be a little inconsistency on android but this is not really a big problem as there are a lot of workarounds. Thanks a lot for your patience and help. Dom |