Felipe Monteiro de Carvalho wrote 7 lines
Thanks.
I had already progressed but I am using
LazAndroidModuleWizard to kickstart, it seems I can't use that method, especially that the code that creates the button is called from the main data module. I am trying to find how to "inject" the button into the datamodule.
If the concept works, then the workflow of creating an android app with Lazarus would be:
- Use a project wizard to setup the project. It will place a fixed java snippet in the src project folder and set up manifest files and ancillary files.
- Run a tool which reads android "headers" and produces a pascal unit(s) according to certain rules.
- Code in pascal :)
The tool will produce for each java class a corresponding pascal class. For example, the pascal android media player class will be analogous to the java one, but acts as a gateway to the actual java class. It uses normal pascal events instead of listeners.
example code for the media player:
gMediaPlayer := TJMediaPlayer.Create;
....
gMediaPlayer.SetOnCompletionListener(DataModuleOnCompletion);
gMediaPlayer.SetOnPreparedListener(DataModuleOnPrepared);
gMediaPlayer.SetDataSource('http://www.soundjay.com/button/button-1.mp3');
gMediaPlayer.Prepare;
gMediaPlayer.Start;
...
gMediaPlayer.Free;
DataModuleOnCompletion and DataModuleOnPrepared are normal pascal methods (TNotifyEvent in this case).
Stephano