Recent

Author Topic: App to Android - Eclipse for GUI and Lazarus for everything but GUI (arm/x86)  (Read 3229 times)

roeug

  • Jr. Member
  • **
  • Posts: 67
    • http://roeug.50megs.com/
All prerequires are described in my previous post (Re: Application runs on Android API level 8 (Emulator) and crashes on above API, Reply #5 on: January 20, 2013, 05:17:23 am): http://forum.lazarus.freepascal.org/index.php/topic,19573.msg111770.html#msg111770
The main idea was
1. To use Eclipse ADT for all UI
2. To use Lazarus for all logic/data manipulations - it is possible to create C (C-language) envelope for Pascal binary library (lib####.so file)

The whole project source (both Eclipse and Lazarus and C and JNI and Android.mk) is available in zip archive at
http://roeug.snow.prohosting.com/testjni_10.zip

To test: import project to Eclipse. Change PATHs (in ndk-build.bat and Lazarus projects, m.b. somewhere else) to your environment! In editing be careful with CaseSensitivity. Don't forget to launch ndk-build.bat.

The main problem for me was JAVA (C without pointers) - it passes parameters to subroutine by value, a subprogram cannot change them to the caller (sure, it returns values - Result in Pascal). This feature can be overcome by sending all parameters in arrays. The second problem is Android who lives to kill applications (for example if a user occasionally re-orients a device), Very very good book (available everywhere in pdf) is Android Programming: The Big Nerd Ranch Guide; ISBN 0321804334; by Hardy, Brian; and by Phillips, Bill; published by The Big Nerd Ranch Guide, Inc. (the sample projects are also available, there exist translations of the book).  I've used some tricks from the book.
PS. For this project I used both fpc2.5.1 precompiled binaries and fpc2.7.1 from trunk, but my another (VCL) project crashes with 2.7.1 at user's events. And now I have a problem which (2.5.1 or 2.7.1) so lib to be deployed?
PS2. I didn't try to pass or return chars and strings - it's too complicated for me.
PS3. FiredMonkey from Delphi XE5 (trial;) is not for real life.
PS4. My "commercial" freeware projects are available at Google Play as Nkeag (Eclipse and Lazarus-lib) and Nke_a (Lazarus VCL, no Eclipse, without graphics).
_____________ Added 10.apr.2014
In android-i386 application (see http://roeug.snow.prohosting.com/testx86_15.zip) lib paths depend of nobody knows what, and I have to send strings to my pas library. The only working code was made by use of an integer array.
Sure for android-i386 architecture only fpc2.7.1 branch was used.
« Last Edit: April 11, 2014, 09:08:02 pm by roeug »

 

TinyPortal © 2005-2018