Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-04

Hints for Android

29 messages · 11 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Santiago A.

Hello:

I'm trying to start my first program in Android, due I am a pascal guy :-) , I will try it with lazarus and windows.

I have found several links about, this one looks the most recent: http://wiki.freepascal.org/Android

Is this the last howto or are there more interesting links in the wiki?

I have read in that link that I need FPC 2.6.x, I have installed 2.6.0 (the one installed with the newest release of lazarus). Will it work?, in other words, (is .0 included in .x? ;-)

Any extra hint or link is welcomed

Saludos Santi

Reply by email

leledumbo
to Felipe Monteiro de Carvalho
For using the LCL

in Android see http://wiki.freepascal.org/Android_Interface instead of the link that you have.

The link above also applies to LCL, since quite recent 2.7.1 has pure Android support (and I've been able to build my Android apps with it)

View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Hints-for-Android-tp4030495p4030498.html Sent from the Free Pascal - Lazarus mailing list .

Reply by email

Sven Barth
to Santiago A.: Hello: I'm trying to start my first program in Android, due I am a pascal guy :-) , I…
Santiago A. wrote 9 lines
Hello: I'm trying to start my first program in Android, due I am a pascal guy :-) , I will try it with lazarus and windows. I have found several links about, this one looks the most recent: http://wiki.freepascal.org/Android Is this the last howto or are there more interesting links in the wiki?

If you want to try the JVM based version you can have a look here: http://wiki.freepascal.org/FPC_JVM_Android_Development

I have read in that link that I need FPC 2.6.x, I have installed 2.6.0 (the one installed with the newest release of lazarus). Will it work?, in other words, (is .0 included in .x? ;-)

Yes, you can compile 2.7.1 with either 2.6.0 or 2.6.2.

Regards,
Sven

Reply by email

Graeme Geldenhuys
to Santiago A.: Hello: I'm trying to start my first program in Android, due I am a pascal guy :-) , I…
Santiago A. wrote
I'm trying to start my first program in Android, due I am a pascal guy :-) , I will try it with lazarus and windows.

I'm about to embark in the Android world too - never done it before. I'll take a look at the FPC support, but I might just take the road more well known, and brush up on my Java skills.

Also, do you know if one needs to pay Google to develop and publish Android apps... eg: like the $99 per year per developer for iOS and Apps Store privileges?

I also had a look at Ubuntu Phone OS on my Nexus 4 today. I was very disappointed in that. For the amount of hype Canonical has raised, they seem to have done very little. 95% of what you see in the current developer preview of Ubuntu Phone is pure mock-ups. And the Facebook and Gmail "apps", is simply the web browser taking you to the respective websites. Some keyboard keys don't work (no comma, no capitals etc), not even the calculator apps is functional! Canonical still needs a lot more "real" work (not mock-ups), before anybody is going to take Ubuntu Phone seriously.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Paul Breneman
to Graeme Geldenhuys: I'm about to embark in the Android world too - never done it before. I'll take a look at…
Graeme Geldenhuys wrote 7 lines
On 2013-04-11 12:35, Santiago A. wrote: > I'm trying to start my first program in Android, due I am a pascal guy > :-) , I will try it with lazarus and windows. I'm about to embark in the Android world too - never done it before. I'll take a look at the FPC support, but I might just take the road more well known, and brush up on my Java skills.

The easiest way I've found for Android is www.processing.org and hopefully a soon update will also make downloading the Android SDK simple. Here is a page I hope to keep updated a little: http://www.turbocontrol.com/mobileard.htm

Reply by email

Sven Barth
to Graeme Geldenhuys: I'm about to embark in the Android world too - never done it before. I'll take a look at…
"Graeme Geldenhuys" wrote 9 lines
On 2013-04-11 12:35, Santiago A. wrote: > > I'm trying to start my first program in Android, due I am a pascal guy > :-) , I will try it with lazarus and windows. I'm about to embark in the Android world too - never done it before. I'll take a look at the FPC support, but I might just take the road more well known, and brush up on my Java skills.

With FPC 2.7.1 you can use native and JVM based development. The corresponding links where in this thread already and if you want an example JVM application I can send you a link to the source (maybe I'll add a github repo for it...)

Also, do you know if one needs to pay Google to develop and publish Android apps... eg: like the $99 per year per developer for iOS and Apps Store privileges?

I've not yet published an app, but AFAIK you don't need to pay anything (maybe only if you have a paid app).

Show quoted text 9 lines
I also had a look at Ubuntu Phone OS on my Nexus 4 today. I was very disappointed in that. For the amount of hype Canonical has raised, they seem to have done very little. 95% of what you see in the current developer preview of Ubuntu Phone is pure mock-ups. And the Facebook and Gmail "apps", is simply the web browser taking you to the respective websites. Some keyboard keys don't work (no comma, no capitals etc), not even the calculator apps is functional! Canonical still needs a lot more "real" work (not mock-ups), before anybody is going to take Ubuntu Phone seriously.

After Canonical has announced yet another display server just when Wayland was starting to off they are more of less dead for me...

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130411/1fea667e/attachment.html>

Reply by email

Michael Van Canneyt
to Sven Barth
Sven Barth wrote 14 lines
Am 11.04.2013 17:08 schrieb "Graeme Geldenhuys" : > > On 2013-04-11 12:35, Santiago A. wrote: > > > > I'm trying to start my first program in Android, due I am a pascal guy > > :-) , I will try it with lazarus and windows. > > I'm about to embark in the Android world too - never done it before. > I'll take a look at the FPC support, but I might just take the road more > well known, and brush up on my Java skills. With FPC 2.7.1 you can use native and JVM based development. The corresponding links where in this thread already and if you want an example JVM application I can send you a link to the source (maybe I'll add a github repo for it...)

This is how I would recommend to combine FPC and Android.

Michael.

Reply by email

Sven Barth
to Michael Van Canneyt
"Michael Van Canneyt" wrote 12 lines
On Thu, 11 Apr 2013, Sven Barth wrote: > > Am 11.04.2013 17:08 schrieb "Graeme Geldenhuys" < : > > > > On 2013-04-11 12:35, Santiago A. wrote: > > > > > > I'm trying to start my first program in Android, due I am a pascal

guy

> > > :-) , I will try it with lazarus and windows. > > > > I'm about to embark in the Android world too - never done it before. > > I'll take a look at the FPC support, but I might just take the road

more

> > well known, and brush up on my Java skills. > > With FPC 2.7.1 you can use native and JVM based development. The

corresponding links where in this thread already and if you want an example JVM application I can send you a link to the source

> (maybe I'll add a github repo for it...) This is how I would recommend to combine FPC and Android.

I would as well, because the LCL Android port is
1) rather experimental
2) does not really fit into how Android works.

To solve 2) basically a rewrite of the Android CustomDrawn Widgetset will be necessary...

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130411/40f5cc45/attachment.html>

Reply by email

Unknown author
to Sven Barth: guy more corresponding links where in this thread already and if you want an example JVM…

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."

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...

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 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" ?

Oh - with the latest development in the android-ndk this looks really promising, too - but I didn't use NativeActivity yet...

d.l.i.w

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130411/acc67a21/attachment-0001.html>

Reply by email

Santiago A.
to Unknown author

El 11/04/2013 18:22, escribi?:

Show quoted text 12 lines
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...

So, you suggest "Learn to program Android with Java, and later, if you want, give a try with FPC"

Saludos Santiago A. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130411/d7eb7bf5/attachment.html>

Reply by email

Graeme Geldenhuys
to Sven Barth: With FPC 2.7.1 you can use native and JVM based development. The corresponding links…
Sven Barth wrote
With FPC 2.7.1 you can use native and JVM based development.

I guess I have lots to learn. :) I thought all Android apps are Java (JVM) based? What is the difference between Native and JVM Android apps? Does Android have a X11 server?

The corresponding links where in this thread already

I'll start reading that tonight. Thanks.

and if you want an example JVM application I can send you a link to the source (maybe I'll add a github repo for it...)

I always learn well with an example. So if you can email me a link, that would be much appreciated.

I've not yet published an app, but AFAIK you don't need to pay anything (maybe only if you have a paid app).

I'm planning on paid apps from the word go (yeah, jump into the deep end and see if I can swim!). I'll do some more internet searching on this tonight. If I find an answer, I'll add a section to the FPC+Android wiki page. Others might find that info useful too.

After Canonical has announced yet another display server just when Wayland was starting to off they are more of less dead for me...

Oh, changed there minds again. I have dropped Ubuntu since they moved to Unity, so don't follow them closely these days.

From your reply to Michael, I assume LCL's Customdrawn-Android backend

will generate a "native" Android app? Still not really sure the difference between Native and JVM apps. As I said, I thought all apps on Android was Java-based, thus runs in a JVM.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Reimar Grabowski
to Graeme Geldenhuys: I guess I have lots to learn. :) I thought all Android apps are Java (JVM) based? What…
Does Android have a X11 server?

No. There is a project in beta stage implementing one in Java on Google play, but it does not look like it is ready for serious work.

Still not really sure the difference between Native and JVM apps. As I said, I thought all apps on Android was Java-based, thus runs in a JVM.

Native apps are just what they sound like, compiled to machine code for the corresponding CPU. If you want to learn more, take a look at the NDK and the NativeActivity documentation. For Google native means C of course but FPC works as well.

R.

Reply by email

Unknown author
to Santiago A.: El 11/04/2013 18:22, escribi?: So, you suggest "Learn to program Android with Java, and…
Learn to program Android with Java, and later, if you want, give a try with FPC

Yes, that's IMHO the easiest way to go - if you want to "learn" Android and create "classical" apps.
For other use cases (porting from WinCE, low level task with almost no GUI, 3D,...) native activity or LCL-Android (honestly don't know the current state) might be more suitable.

Eclipse + ADT has various tools that really help a lot: Lint (performance hints, compatibility tipps, etc.) , a GUI editor, ...

But don't get me wrong, you can create the same output with fpc-jvm, too - maybe with a little bit more work.

If you want to use fpc - I would suggest using E + ADT for GUI creation and resource management anyway...
There is this nice "Android R.java -> R.pas converter" for converting the java resource class(es) to a pascal unit, unfortunately I don't know, where I got it from...

d.l.i.w
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130411/278a17c3/attachment-0001.html>

Reply by email

Sven Barth
to Unknown author: 1. Google Playstore http://support.google.com/googleplay/android-developer/answer/113468?h…
Show quoted text 9 lines
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.

Show quoted text 10 lines
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...

Show quoted text 18 lines
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...

Show quoted text 9 lines
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

Reply by email

Sven Barth
to Graeme Geldenhuys: I guess I have lots to learn. :) I thought all Android apps are Java (JVM) based? What…
Graeme Geldenhuys wrote 6 lines
On 2013-04-11 16:35, Sven Barth wrote: > > With FPC 2.7.1 you can use native and JVM based development. I guess I have lots to learn. :) I thought all Android apps are Java (JVM) based? What is the difference between Native and JVM Android apps?

First and foremost: Android is basically just a Linux with a different userspace. So you are able to write applications that can run on Android and Google even provides a Native Development Kit which contains binutils and C compilers for Android. To access the GUI though you need to go through Java functions and your app must be a library (*.so) that can be loaded by the Dalvik VM and communicates using JNI (Java Native Interface). There is even a (paid) app that provides a Free Pascal IDE together with a (native) FPC compiler (I don't know though whether the app itself is written natively or as a JVM one).

The important difference between Java code and native one: you need to adjust the native code for each platform while the Java one runs on all platforms. E.g. there exists x86-android, arm-android and since some time also mips-android (though only the former two are currently supported by FPC). Also for ARM you can have different flavors. E.g. there are ARMv5 and ARMv6 CPUs and also those with an additional NEON FPU (FPC doesn't support that currently, but it would be a nice addition :) ).

Does Android have a X11 server?

As Reimar wrote there exists one which you can use for simple programs, but normally you go through the Android GUI. For native programs this can be simplified by either using OpenGL or use SDL (which provide a port). You could also use QT5 which has an (AFAIK experimental) port for Android (though there aren't - again AFAIK - no Pascal bindings yet).

Show quoted text 6 lines
> and if you want an example > JVM application I can send you a link to the source (maybe I'll add a > github repo for it...) I always learn well with an example. So if you can email me a link, that would be much appreciated.

I had published the example first here:
http://lists.lazarus.freepascal.org/pipermail/lazarus/2011-December/069470.html

You'll find a link further down in the thread. Michael also wrote an article in the freeX about that based on my app (though he developed his own one).

Show quoted text 5 lines
> After Canonical has announced yet another display server just when Wayland > was starting to off they are more of less dead for me... Oh, changed there minds again. I have dropped Ubuntu since they moved to Unity, so don't follow them closely these days.

I've switched from (K)Ubuntu in winter 2008... I've just heard this about the Mir display server through Phoronix.

>From your reply to Michael, I assume LCL's Customdrawn-Android backend will generate a "native" Android app? Still not really sure the difference between Native and JVM apps. As I said, I thought all apps on Android was Java-based, thus runs in a JVM.

Yes, the Customdrawn-Android widgetset is a native one. You don't have LCL support for jvm-android, but the IDE works (if you look a bit further in the mailing list threads from December 2011 you'll notice me complaining about a few things that didn't work back then :) )

Regards,
Sven

Reply by email

Sven Barth
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 7 lines
On Thu, Apr 11, 2013 at 5:42 PM, Sven Barth wrote: > To solve 2) basically a rewrite of the Android CustomDrawn Widgetset will be > necessary... You can start your own widgetset in another directory if you don't like CustomDrawn, but in my oppinion my design is 100% correct, so no, nothing to be rewritten here.

It's not CustomDrawn itself that is my problem, but the way you interface with Android. Currently every form is mapped to one single Activity and this is just not the Android way. Every form should have it's own Activity and the global state should be mapped through an extension of the android.app.Application class. Also you didn't seem to notice that the only fixed exports that are really necessary are JNI_onload and JNI_onunload. The other ones can be inserted using JNI which you already provide a possiblity for but you've added the comment "apparently not needed" there and didn't complete that. Of course, if you manually export all functions you don't need that, but if you use this dynamic JNI approach you reduce the amount of functions that the user needs to export to just two basic functions.

Regards,
Sven

Reply by email

Felipe Monteiro de Carvalho
to Sven Barth
Sven Barth wrote
Every form should have it's own Activity and the global state should be mapped through an extension of the android.app.Application class.

Do you have any link to the docs that say that every window should have a new Activity? Window does not descend from Activity. It does not look correct to me... but I will study the issue.

For dialogs at least I am 100% sure they don't use one Activity per dialog. Nothing in the docs here about this:
http://developer.android.com/reference/android/app/AlertDialog.Builder.html

Also: if I don't do it like that what's the difference for my user? I haven't see one so far.

Also, I know applications with millions of downloads in the store which don't use one Activity per window and never saw a problem with it. We use one activity for the main application and another for the crash logger, but not one per form AFAIK, thought I am not 100% knowledged in the source code.

Anyway, even if I went to change this (which so far I am not convinced of), it is hardly a "rewrite". Something like 0,1% of the code would need to be changed.

Show quoted text 7 lines
Also you didn't seem to notice that the only fixed exports that are really necessary are JNI_onload and JNI_onunload. The other ones can be inserted using JNI which you already provide a possiblity for but you've added the comment "apparently not needed" there and didn't complete that. Of course, if you manually export all functions you don't need that, but if you use this dynamic JNI approach you reduce the amount of functions that the user needs to export to just two basic functions.

Ok, now this is something interrested that I just learned! I had no idea about this. This is trivial to change, the only work will be testing in all the devices if it still works afterwards. I tested the current implementation in dozens of devices.

Felipe Monteiro de Carvalho

Reply by email

Graeme Geldenhuys
to Sven Barth: Ah, ok. Thanks for clarification. It's Eclipse... that is enough reason for me to avoid…
Sven Barth wrote
It's Eclipse... that is enough reason for me to avoid it...

You should take a look at IntelliJ IDEA - simply the best IDE I have seen. The "codetools" features are unbelievable. Fantastic refactoring support, excellent repository integration and loads of user customizable option. If even has multiple language syntax highlighting and code completion in the same source file. eg: Thing JavaScript code block inside a Java or HTML source file.

> Did someone make a different experience? From the examples I have seen, and wiki pages I have read... the code

doesn't really seem very pascal like. I think I'll rather just use pure Java instead. It's time I make my life easier for a change - instead of always taking the route less travelled.

I downloaded the ADT Bundle from Google last time. One archive that you unzip, and everything is already setup. Just double click the eclipse icon and I was ready to go. Can't get easier than that!

I was quite impressed with the bit I have seen last night of Eclipse. I haven't run Eclipse in many years. It seemed rather fast too. Not sure if that was due to SWT, latest Java Runtime, or my current system.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Felipe Monteiro de Carvalho
to Felipe Monteiro de Carvalho: On Fri, Apr 12, 2013 at 10:18 AM, Sven Barth Do you have any link to the docs that say…
Felipe Monteiro de Carvalho wrote
Do you have any link to the docs that say that every window should have a new Activity? Window does not descend from Activity. It does not look correct to me... but I will study the issue.

So if you have 1 app with 1 button and clicking on the button you get a fullscreen window to select a file you would need 2 activies (because 2 forms)? Looks very strange to me.

Felipe Monteiro de Carvalho

Reply by email

Sven Barth
to Felipe Monteiro de Carvalho: On Fri, Apr 12, 2013 at 10:18 AM, Sven Barth Do you have any link to the docs that say…
Felipe Monteiro de Carvalho wrote 8 lines
On Fri, Apr 12, 2013 at 10:18 AM, Sven Barth wrote: > Every form should have it's own Activity and > the global state should be mapped through an extension of the > android.app.Application class. Do you have any link to the docs that say that every window should have a new Activity? Window does not descend from Activity. It does not look correct to me... but I will study the issue.

This is how all those Java examples work. You want to show another view? Do a new activity...

Show quoted text 7 lines
For dialogs at least I am 100% sure they don't use one Activity per dialog. Nothing in the docs here about this: http://developer.android.com/reference/android/app/AlertDialog.Builder.html Also: if I don't do it like that what's the difference for my user? I haven't see one so far.

A main problem is the lifetime of activities: if the user changes the activity (e.g. from your app to the phone app) it is more or less normal that the activity will be closed and restarted when the user switches back. The native library won't be unloaded however, because the process will continue to run until the OS decides that it needs the resources (or shuts down). In the current implementation this restarting of an activity also means a reinitialization of the application, because the ActivityOnCreate handler will be called again. This normally also means that the CreateForm calls will be run again which can result in memory leaks if done "right". This could be solved by using a descendant of android.app.Application to hold the global state.

And for multiple activities: if you use multiple activities you can still use the approach of using only one activity for all forms by reparenting forms or using frames. You can't go the other way round currently. Also using multiple activities can simplyfy/clarify the registration for intents.

Show quoted text 9 lines
Also, I know applications with millions of downloads in the store which don't use one Activity per window and never saw a problem with it. We use one activity for the main application and another for the crash logger, but not one per form AFAIK, thought I am not 100% knowledged in the source code. Anyway, even if I went to change this (which so far I am not convinced of), it is hardly a "rewrite". Something like 0,1% of the code would need to be changed.

If you think only a little part needs to be changed for this, then the better :)

Show quoted text 10 lines
> Also you didn't seem to notice that the only > fixed exports that are really necessary are JNI_onload and JNI_onunload. The > other ones can be inserted using JNI which you already provide a possiblity > for but you've added the comment "apparently not needed" there and didn't > complete that. Of course, if you manually export all functions you don't > need that, but if you use this dynamic JNI approach you reduce the amount of > functions that the user needs to export to just two basic functions. Ok, now this is something interrested that I just learned! I had no idea about this.

Now you know it :)

This is trivial to change, the only work will be testing in all the devices if it still works afterwards. I tested the current implementation in dozens of devices.

And then there are the usual problems that the CustomDrawn-Android widgetset is still experimental (so not necessarily a problem of the interface design). There are different problems with resizing, etc., but this could probably be a problem inherent to the LCL itself, because it's originally based of fixed pixel designs... When I find the time again I can try to report bugs regarding these.

Regards,
Sven

Reply by email

Unknown author
to Sven Barth: Ah, ok. Thanks for clarification. It's Eclipse... that is enough reason for me to avoid…

Hi,

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

Hm, it's not that bad - but you love Lazarus more afterwards :)

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

know about the inner one...
The expression was inside an AWTextView.setText(), I assume I got an error without, but I don't exactly know it any more...

Show quoted text 6 lines
> Is it possible to mix Pascal and Java? 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.

Thanks...

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.

Right, thats true...

[..] also those with an additional NEON FPU (FPC doesn't support that

currently, but it would be a nice addition)
definitely +1, together with simd intrinsics (or something equivalent)... :)

Graeme Geldenhuys wrote
I think I'll rather just use pure Java instead. It's time I make my life

easier for a change
For a "normal" app thats my attitude, too.
Altough I really would like to try what FPC + NDK is capable of - sometime later :)

Regards,
d.l.i.w

Reply by email

José Mejuto
to Felipe Monteiro de Carvalho: On Fri, Apr 12, 2013 at 10:46 AM, Felipe Monteiro de Carvalho So if you have 1 app with 1…

El 12/04/2013 11:22, Felipe Monteiro de Carvalho escribi?:

Show quoted text 10 lines
On Fri, Apr 12, 2013 at 10:46 AM, Felipe Monteiro de Carvalho wrote: > Do you have any link to the docs that say that every window should > have a new Activity? Window does not descend from Activity. It does > not look correct to me... but I will study the issue. So if you have 1 app with 1 button and clicking on the button you get a fullscreen window to select a file you would need 2 activies (because 2 forms)? Looks very strange to me.

Hello,

Yes, that's the way/idea. Every activity should be considered an atomic user interface operation, any operation that could be logically performed in other activity should be in other activity. OS can unload each activity at any time, except the forefront one. Also data related directly to each activity is expected to be in activity related memory so a simple rotation of the device kills this memory blocks and the programmer should save important state variables in a process related memory.

From a pascal/LCL point of view your approach is more robust because LCL is not designed to survive a situation where only one form (the forefront one) can exists, while an android app should survive.

Usual bug in android apps follows this steps:

1) Show an activity
2) User selects something that opens a second activity
3) Second activity is created and shown.
4) First activity is destroyed by the OS.
5) Second activity is destroyed.
6) First activity is recreated by the OS but its state is as how it was in step 1, not in step 2 (programmer expect).

Reply by email