[Lazarus] Android Target GUI

Marc Santhoff M.Santhoff at web.de
Sun Feb 26 14:34:55 CET 2012


Am Freitag, den 17.02.2012, 09:11 +0100 schrieb
michael.vancanneyt at wisa.be:
> 
> On Fri, 17 Feb 2012, Marc Santhoff wrote:
> 
> > Hi,
> >
> > I'd like to know, how GUI building for Android is handled using Lazarus.
> >
> > I have pretty much no idea of the Android SDK or things, but I
> > understand that this target involves compiling the code to Java byte
> > code. The details are not what I need at the moment, only a broad
> > overview how things work together and what role Lazarus plays in the GUI
> > part.
> 
> There are 2 approaches:
> 
> 1. Do as Felipe does. He has described how it works.
> 
> 2. Use the JVM backend. In that case, you make direct use of the Java
>     classes and the android API. Your app willl look and behave like any
>     other Android app. (I am not sure what Felipe's approach results in)
> 
> In the second case, Lazarus offers no help except that it's an excellent
> Pascal editor/compiler. But the GUI designing part of Lazarus is then not
> used. You must create the XML files manually.

I see, my next stop will be the Android SDK for understanding this XML
type for describing the viasual part.

> >
> > How is the GUI specified, is it drawn like building a form or is it made
> > by drawing on a canvas in code?
> 
> Android uses XML files to specify the layout. This is the recommended way by
> Google. You can build the GUI in code as well, but then you're pretty much in
> uncharted territory.

OK, good to know.

> >
> > Or does Lazarus/fpc only generate the event handlers an making a GUI is
> > a seperate task for a HTML designer or the like?
> 
> The android API does not know event handlers as Object Pascal does. 
> It has some form of callback objects, which are pretty much the same thing, yet 
> they work slightly different.
> 
> Basically, your class must expose a certain interface, and then it can be
> assigned as the 'event handling object' to the GUI control.

Reminds me of GTK. Semms to be no big deal ...

> It's probably easier to see it work in code than explain in words :-)
> 
> I just wrote an app in this way. It has about 160 lines of code (including
> declaration) for a 2-form program that talks to a database to show some
> stuff on screen.

Wetting my appetite here, is that program already in some repo or
publicly visible? ;)
Or what magazine or book do I need to buy?

Currently I'm only sorting out the masses of information, there are some
tutorials in magazines already, but since the goal is to understand how
to write android apps fpc will be most welcome.

Thanks a lot!
Marc

-- 
Marc Santhoff <M.Santhoff at web.de>





More information about the Lazarus mailing list