[Lazarus] Hints for Android

Sven Barth pascaldragon at googlemail.com
Thu Apr 11 21:06:33 CEST 2013


On 11.04.2013 18:22, dev.dliw at gmail.com wrote:
> Hi,
>
> 1. Google Playstore
>
> http://support.google.com/googleplay/android-developer/answer/113468?hl=en
>
> "You must register to be able to distribute your products through Google
> Play. There is a one time $25 registration fee charged for a Google Play
> Developer Console account."

Ah, ok. Thanks for clarification.

> 2. Android development
>
> I myself used fpc-jvm, its really great to see it working on a real
> device - really good job..
>
> ... but for starters it's really the best thing to start with java as
> there are much more information / samples / docs around...
>
> Eclipse with google's adb is a good IDE [although somewhat slow :) ] to
> develop and debug android apps...

It's Eclipse... that is enough reason for me to avoid it...

> The main problem I had with fpc-jvm is, that:
>
> - naming makes you think "around two corners", especially when trying to
> understand a java sample and writing pascal code
>
> eg. Android.Widget.Button becomes AWButton
>
> - Code becomes really un-pascalish as one has (?) to use java types, you
> have to write things like
>
> ---
>
> JLString(' am' +
> String(ATFDateFormat.getDateFormat(self).format(JUDate.Create(start)).toString)
> );
>
> ----
> and "this Pascal" has no advantage over Java :)

Did you use "modeswitch unicodestrings"?

Also at least the outer cast shouldn't be necessary in my opinion. I 
don't know about the inner one...

>
> Did someone make a different experience?
>
> Btw.
>
> Is it possible to mix Pascal and Java?
>
> Let's say I have logic already there in Pascal and want to use it for an
> Android app - can I mix code at "class level" ?

AFAIK yes. You just need to careful if you have units that contain 
initalization/finalization sections. These are implemented as static 
constructors/destructors of a class with the unit name as class name and 
you need to access that class if you want the 
initialization/finalization section to be run.

Btw: if you have specific questions about why certain things don't work 
or to ask whether certain things could be made working you should post 
in the fpc-devel/fpc-pascal list, because Jonas (who has implemented the 
jvm target) is there.

Regards,
Sven




More information about the Lazarus mailing list