WARNING: THIS INFORMATION IS DATED AND NEEDS UPDATING
Go back to Custom Drawn Interface
Architecture
LCL-CustomDrawn-Android utilizes a minimal Java application which communicates with our Pascal library and sends all events to it and also obeys commands from it. The communication is done via JNI as supported by Google. The controls are not native, instead they are all drawing using TRawImage+TLazIntfImage+TLazCanvas and events and the painting are clipped using LazRegions. The drawing itself is done in Pascal using jnigraphics to draw on a Bitmap Java object which is then drawn by the minimal Java activity on a SurfaceView.
Our previous and short-lived attempt to write an LCL Interface for Android (LCL-Android) utilized a non-standard method of using native executables which communicated with a Java machine via Pipes. This method was abandoned because it was considered unsupported by Google. It is considered obsolete and people should use LCL-CustomDrawn-Android instead. This older interface was documented in Android Interface.
Roadmap
Part 1, until March 2012:
Build the set of Lazarus Custom Drawn ControlsInitial bindings for the Android APIsCreate an application to automatically generate the bindingsStart the new widgetsetImplement support for JNIMerge the Lazarus Custom Drawn Controls into the LCL and use them to implement all basic controlsAdd text support for AndroidImplement basic window client area scrolling- Add mobile emulator for desktop platforms
- Improve the mobile scrolling
Add text support in X11Add DPI awareness and adaptation in the LCLAdd non-native text support via pasfreetype
Part 2: April, May, June 2012:
TButton improve the Android visual- TBitBtn
TRadioButton finish the native look- Calendar dialog -> Problematic as the LCL has no calendar dialog, it just opens a normal form and puts a calendar on it, so we need a TCDCalendar widget
- MaskEdit
Improve TComboBox- TMemo
- TListView as a list with columns
TMainMenu- Database with sqlite
- Barcode reading
- Windows add-on installer
Using the Android SDK, Emulator and Phones
Android Programming
See Android Programming, also includes caracteristics of the various phones relevant for programming.
Configuring the Free Pascal Compiler for Android
NOTE: |
---|
The cross-compiler instructions below are probably obsolete, since support for the Android target is present in the trunk (development) version 2.7.1 of FPC. Here are up to date instructions: building a cross-compiler for Android target. |
Use the ready Virtual Box Image with FPC and Lazarus
The fastest way to configure Free Pascal and Lazarus for Android development is simply using a pre-configured virtual machine image which already includes Mageia Linux 1, KDE, Lazarus 0.9.31, Subversion, Free Pascal for both x86-linux and arm-linux (targetting Android), the Android SDK, the Android NDK, Java, Ant, Gtk2 and all it's development packages, the GNU debugger (GDB), subversion and everything else necessary for building Android applications with Lazarus.
The download like for the virtual machine image is: https://sourceforge.net/projects/p-tools/files/Lazarus_for_Android_VM_Image/snapshot_30_dez_2011/ (warning: the VirtualBox image was created using the Mac OS X default Zip utility and not all zip applications can handle it. The Mac OS X default zip application can, and PeaZip too and WinRAR too. Both 7-Zip and the Windows 7 default unzipper fail.
The virtual machine image is composed by two files: “Android Devel VM.vbox” and “Android Devel VM.hdd”. Both need to be located in the same folder and also note that the source forge download is a zipped file, so it needs to be unzipped. After unzipping the VM image has 5,2GB. To use this virtual machine one should install Virtual Box and then use it to open the .vbox file. Then one can already use this Linux virtual machine to build Android applications. The process of building an application involves first opening Lazarus and building the application in Lazarus, for example the example project available on ~/Programas/lazarus/example/androidlcl/ and then going into the Linux terminal, navigating to ~/Programas/lazarus/example/androidlcl/android and issuing the command “ant debug” which will generate the APK file in ~/Programas/ lazarus/example/androidlcl/android/bin/LCLExample-debug.apk. There are two users in the virtual machine: “root” and “pascaldev” and both of them use the password “root”.
Note that the virtual machine contains the Lazarus source code from when it was created, but one can also use svn update to get the latest code. Note that this involves some risks, however, as the trunk version might ocasionally contain problems.
Building the compiler yourself in Windows
Step 1 - Install the Android SDK and NDK
Download from Google and install both the SDK and the NDK for Windows.
Check your path to the binutils installed by the NDK. For example, for NDK r7 installed in C:\Programas\android-ndk-r7\ the path is C:\Programas\android-ndk-r7\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin
Also check your path to the libraries installed by the NDK. For example, for NDK r7 installed in C:\Programas\android-ndk-r7\ the path is C:\Programas\android-ndk-r7\platforms\android-8\arch-arm\usr
Step 2 - Download FPC 2.5.1 from January 19th
Create a folder to store the FPC trunk source code and checkout revision 16790
Or if you want support for database and many other nice fixes use the branch fpc4android from here:
svn co https://p-tools.svn.sourceforge.net/svnroot/p-tools/fpc4android fpc4android
Step 3 - Install FPC 2.4.4
An easy way to obtain a good FPC 2.4.4 is installing Lazarus 0.9.30.2. For example, let's say you install this Lazaru ..... http://wiki.freepascal.org/Custom_Drawn_Interface/Android#NDK_Libraries_available_in_Android_2.2_.28API_level_8.29