Android trans improvement

Monkey Forums/Monkey Bug Reports/Android trans improvement

secondgear(Posted 2012) [#1]
I'd like to suggest a simple change to trans/targets/android.monkey - moving "template files" under "create package" like this:

[monkeycode]
'create package
Local jpath$="src"
DeleteDir jpath,True
CreateDir jpath
For Local t$=Eachin app_package.Split(".")
jpath+="/"+t
CreateDir jpath
Next
jpath+="/MonkeyGame.java"

'template files
For Local file$=Eachin LoadDir( "templates",True )
Local str$=LoadString( "templates/"+file )
str=ReplaceEnv( str )
SaveString str,file
Next
[/monkeycode]
This would preserve .java files copied from templates/src/<your package name>, otherwise they are erased by DeleteDir.

In my case, I needed to extend MonkeyGame to override onActivityResult. It seems the only way to have a public super-class is to put it in a separate file. Using templates folder seems like a decent solution.