Lazarus

Announcements => Lazarus => Topic started by: felipemdc on November 30, 2011, 10:03:23 pm

Title: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on November 30, 2011, 10:03:23 pm
Hello,

Porting the LCL for Android has been a quite hard task, so I started with an architecture which proved itself a bad choice and now I changed it radically to a much better solution. So LCL-CustomDrawn-Android is the new architecture which is here to stay for porting the LCL to Android and other smartphones and the old LCL-Android is obsolete and will be removed.

The new architecture has the following features:
*Backends for X11, Android and Windows and a partially working one for Cocoa, more can be added in the future
*Painting is done completely inside Lazarus without any interference from the native libraries except for text drawing. This assures a complete perfection of the executed drawings in all platforms and a uniform level of supported features
*Only 1 native window is utilized for each form, in the Android backend at the moment this is 1 native window for the entire application
*Utilizes the Lazarus Custom Drawn Controls for implementing the LCL standard controls
*Utilizes as it's painting engine the lcl parts: TLazIntfImage, TRawImage, lazcanvas and lazregions

For more details about LCL-CustomDrawn-Android see:

http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: Leledumbo on December 01, 2011, 03:05:50 am
Nice idea, Felipe. I also agree with this. Android seems has different point of view regarding GUI architecture (activity vs form, etc.) and that's contradictive with current LCL approach. I'll try as soon as possible.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: herux on December 01, 2011, 06:38:55 am
Cool  8), I will try it soon
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: mschnell on December 01, 2011, 02:04:47 pm
*Backends for X11, Android and Windows and a partially working one for Cocoa, more can be added in the future
*Painting is done completely inside Lazarus without any interference from the native libraries except for text drawing. This assures a complete perfection of the executed drawings in all platforms and a uniform level of supported features

This sounds a lot like the fpGUI LCLWidgetType. How is same related ?

-Michael
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 01, 2011, 03:15:57 pm
This sounds a lot like the fpGUI LCLWidgetType. How is same related ?

http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface#Comparison_of_LCL-CustomDrawn_and_LCL-fpGUI
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 01, 2011, 03:42:28 pm
Nice idea, Felipe. I also agree with this. Android seems has different point of view regarding GUI architecture (activity vs form, etc.) and that's contradictive with current LCL approach.

Except for the need to save the application state when going to background, I don't see any incompatibility. I still have to verify what exactly that will mean for us and what will need to be done / extended to support this.

About Activity, the vast majority of Android applications have only 1 activity and the second activity is usually a crash logger.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: herux on December 01, 2011, 04:45:56 pm
hello felipe, my library can not loaded, as shown in the logs below
Code: [Select]
12-01 15:28:34.208: I/lclproject(433): Trying to load liblclapp.so
12-01 15:28:34.248: D/dalvikvm(433): Trying to load lib /data/data/com.pascal.lcltest/lib/liblclapp.so 0x405154d8
12-01 15:28:34.298: E/lclproject(433): WARNING: Could not load liblclapp.so
12-01 15:28:34.328: W/System.err(433): java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1311]:    33 cannot locate 'iconv_open'...
12-01 15:28:34.328: W/System.err(433): at java.lang.Runtime.loadLibrary(Runtime.java:434)
12-01 15:28:34.348: W/System.err(433): at java.lang.System.loadLibrary(System.java:554)
12-01 15:28:34.348: W/System.err(433): at com.pascal.lcltest.LCLActivity.<clinit>(LCLActivity.java:73)
12-01 15:28:34.348: W/System.err(433): at java.lang.Class.newInstanceImpl(Native Method)
12-01 15:28:34.348: W/System.err(433): at java.lang.Class.newInstance(Class.java:1409)
12-01 15:28:34.348: W/System.err(433): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
12-01 15:28:34.398: W/System.err(433): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
12-01 15:28:34.398: W/System.err(433): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
12-01 15:28:34.398: W/System.err(433): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-01 15:28:34.398: W/System.err(433): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
12-01 15:28:34.398: W/System.err(433): at android.os.Handler.dispatchMessage(Handler.java:99)
12-01 15:28:34.398: W/System.err(433): at android.os.Looper.loop(Looper.java:123)
12-01 15:28:34.398: W/System.err(433): at android.app.ActivityThread.main(ActivityThread.java:3683)
12-01 15:28:34.408: W/System.err(433): at java.lang.reflect.Method.invokeNative(Native Method)
12-01 15:28:34.408: W/System.err(433): at java.lang.reflect.Method.invoke(Method.java:507)
12-01 15:28:34.408: W/System.err(433): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-01 15:28:34.431: W/System.err(433): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-01 15:28:34.431: W/System.err(433): at dalvik.system.NativeStart.main(Native Method)

I have checked the file
Code: [Select]
$ file liblclapp.so
liblclapp.so: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, not stripped

I use this fpc version, does it cause?
Code: [Select]
Free Pascal Compiler version 2.6.0rc1 [2011/11/11] for arm
Copyright (c) 1993-2011 by Florian Klaempfl and others
/home/herux/Documents/fpcsvn/tags/release2_6_0/compiler/ppcrossarm [options] <inputfile> [options]
Put + after a boolean switch option to enable it, - to disable it
  -a     The compiler doesn't delete the generated assembler file
      -al        List sourcecode lines in assembler file
      -an        List node info in assembler file
      -ap        Use pipes instead of creating temporary assembler files
      -ar        List register allocation/release info in assembler file
      -at        List temp allocation/release info in assembler file

Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 01, 2011, 05:37:09 pm
From your error I would say that you didn't do step 2 here:

http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android#Compiling_the_example_LCL_Android_Application

See also:

http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android#Step_2_-_Configuring_the_LCL
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: LA.Center on December 03, 2011, 11:50:12 pm
felipemdc, does this mean that we can now paint on the form? Which controls are supported? please forgive if maybe a dumb question.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 04, 2011, 09:55:39 am
felipemdc, does this mean that we can now paint on the form?

Yes. TForm.OnPaint is supported. TCustomControl descendents which draw themselves are also supported. Multiple levels of controls inside controls are also supported, and also OnMouseDown, OnMouseUp, OnMouseMove

Quote
Which controls are supported? please forgive if maybe a dumb question.

Only TButton (without text), TCheckBox (without text), TArrow, TProgressBar and TTrackBar

http://wiki.lazarus.freepascal.org/Roadmap#Status_of_native_controls_on_each_widgetset

Adding controls is very simple and easy, but the major problem is that we lack text support, so for many controls it gets pointeless to add them before text support is finished.

If you need any particular control just say and I can add it before other ones, but keep in mind that I estimate that it might take some months to get text rendering to work properly.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: Jonathan on December 05, 2011, 09:28:19 am
Hi ,felipemdc ! I build the project meeting an error:
Code: [Select]
Options changed, recompiling clean with -B
Hint: Start of reading config file /home/hyy/.fpc.cfg
Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Hint: End of reading config file /home/hyy/.fpc.cfg
Error: Illegal parameter: -WR

Thank you!
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: LA.Center on December 05, 2011, 09:40:50 am
Could I use small text images, on the button, or as label for example. I only need about 10 basic controls (Label, Button, TextEdit, Memo, Listbox, checkbox, trackbar, progressbar, panel, image) and something I can paint on.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 05, 2011, 09:55:00 am
Hi ,felipemdc ! I build the project meeting an error:

Which compiler are you using? Which lpi file are you building? Which Lazarus version do you have?
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: Jonathan on December 05, 2011, 10:07:53 am
I build the cross_compiler as http://wiki.lazarus.freepascal.org/Setup_Cross_Compile_For_ARM. This Cross_Compileer works in Your Prev Project : New OpenGL Android Example . FPC:2.6.0; lpi file:androidlcltest.lpi .;lazarus revesion:33966.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 05, 2011, 10:11:57 am
I build the cross_compiler as http://wiki.lazarus.freepascal.org/Setup_Cross_Compile_For_ARM. This Cross_Compileer works in Your Prev Project : New OpenGL Android Example . FPC:2.6.0; lpi file:androidlcltest.lpi .;lazarus revesion:33966.

Strange, you can try to simply remove -WR from the "Project Options", it is there in one of the pages.

But in general I recommend using a compiler from aprox. 19th January 2011 FPC 2.5.1 trunk as explained here: http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android#Free_Pascal_Bugs_on_Android_Support
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 05, 2011, 06:35:15 pm
Could I use small text images, on the button, or as label for example. I only need about 10 basic controls (Label, Button, TextEdit, Memo, Listbox, checkbox, trackbar, progressbar, panel, image) and something I can paint on.

I implemented today basic support for TBitmap and TCanvas.Draw(X, Y, TBitmap), so yes, you can use images for text.

TTrackBar and TProgressBar already worked before and TButton and TCheckBox work except for the text.

TEdit/TMemo is very far because the require a lot of features, in fact they so far that I am considering if I should put temporarely a native TEdit and TMemo for use in Android. Probably I'll try this temporary work around.

TLabel and TListBox require text support and TCDListBox isn't yet finished too.

Do you need text in TPanel? If no, then it should be easy to implement.

TImage maybe even already works, I'm not sure. It would be good if you can test.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: Jonathan on December 06, 2011, 02:23:45 am
I simply remove -WR from the "Project Options" and it could be built successfully.Then I use the command  "ant debug" and I get the APK(1.7M).when I  install into the emulator and click the icon,nothing happens! I am sure it is for ARM  by the command "file ****"  .So I do not know where the wrong goes!
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: LA.Center on December 06, 2011, 02:27:10 am
@felipemdc
OK that is super, I will give it a try now and see what happens. Great work man!
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 06, 2011, 07:44:16 am
I simply remove -WR from the "Project Options" and it could be built successfully.Then I use the command  "ant debug" and I get the APK(1.7M).when I  install into the emulator and click the icon,nothing happens! I am sure it is for ARM  by the command "file ****"  .So I do not know where the wrong goes!

Like written here, whenever something goes wrong always use adb logcat:

http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android#Oh_no.21_My_LCL_Android_application_doesn.27t_work

But I'd bet that your problem is what I have already written before: you should not use fpc 2.6.0, you need to use fpc 2.5.1 from svn trunk from 19th january.

The OpenGL example works fine with fpc 2.6.0 because it uses very few features and RTL calls (actually none?), but the LCL uses a huge amount of RTL features and calls and those will crash because of a bug introduced in february.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: Jonathan on December 06, 2011, 08:44:48 am
Quote
you need to use fpc 2.5.1 from svn trunk from 19th january.

Hi felipemdc!
So how to get fpc 2.5.1(19th january ) by the command SVN?? What is   The revision of fpc2.5.1 (19th january ) ? So I could use the command "svn update -r ***".
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: Leledumbo on December 06, 2011, 08:55:32 am
Quote
how to get fpc 2.5.1(19th january )
Here (http://sourceforge.net/projects/p-tools/files/Free%20Pascal%20for%20ARM/) you go
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 06, 2011, 08:56:26 am
Hi felipemdc!
So how to get fpc 2.5.1(19th january ) by the command SVN?? What is   The revision of fpc2.5.1 (19th january ) ? So I could use the command "svn update -r ***".

You can find this info in the fpc viewcv: for example you could try this revision: http://svn.freepascal.org/cgi-bin/viewvc.cgi?view=rev&revision=16790

I don't remember anymore which one I used exactly, but I think it shouldn't matter much.

But like Leledumbo said, you can use the pre-compiled snapshot x86-linux -> arm-linux which is known to work very well.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: Jonathan on December 06, 2011, 09:03:53 am
Quote
But like Leledumbo said, you can use the pre-compiled snapshot x86-linux -> arm-linux which is known to work very well.

Hi felipemdc, Could you give me the link about that? I do not know the details!
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: Jonathan on December 06, 2011, 09:11:24 am
Here (http://sourceforge.net/projects/p-tools/files/Free%20Pascal%20for%20ARM/) you go

I tried  hours ago!  I did the Step 3 - Install the Free Pascal Cross-Compiler ,then I  make the lastest lazarus and met an  Error,so the lazarus was not installed successfully!
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 06, 2011, 09:28:20 am
I tried  hours ago!  I did the Step 3 - Install the Free Pascal Cross-Compiler ,then I  make the lastest lazarus and met an  Error,so the lazarus was not installed successfully!

Please describe more specifically what you did, step-by-step, showing console command lines for example, even screenshots if necessary, and the relevant parts of the output in the command line. Your description of what you tried is so imprecise that I can only try guessing what you actually did.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: Jonathan on December 06, 2011, 09:51:03 am
Oh,Sorry!
 I did  as  Android_Interface#Using_the_pre-compiled_compiler said.
Required Environment: FPC 2.4.4
Step1: I install binutils2.22 instead ,because my system :Ubuntu .I do not find suitable cross-arm-linux RPM.
Step2,3,4:I did the same as the tutorial.
After Step 4:I try to  make install the lastest svn lazarus ,but not successfully!
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 06, 2011, 10:28:55 am
After Step 4:I try to  make install the lastest svn lazarus ,but not successfully!

Could you show the output of these commands:

cd lazarussvn
fpc
make bigide
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: Jonathan on December 06, 2011, 10:46:15 am
 %)   
I find that It lacks some packages........I  figure out that the command "apt-get install -f" does not works successfully!
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 13, 2011, 07:24:25 am
Could I use small text images, on the button, or as label for example. I only need about 10 basic controls (Label, Button, TextEdit, Memo, Listbox, checkbox, trackbar, progressbar, panel, image) and something I can paint on.

Actually now I am implementing native text, so very soon a lot of those controls will be working.

I also implemented MessageBox / MessageDlg via native dialogs. Changing between forms works too, although so far only fullscreen forms are supported. But I already see how to support dialogs.

The next steps are:

1> Implement DPI awareness in the LCL

2> Optimizing Invalidate to invalidate only 1 control when requested so
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: LA.Center on December 13, 2011, 09:02:55 am
@felipemdc
You the man :)
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 13, 2011, 10:38:43 am
Thanks, you can see the new look of the example here:

http://wiki.lazarus.freepascal.org/images/6/6a/Custom_drawn_android_test1.png

I still have to investigate why it draws text fine in the button but not in the CheckBox.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: LA.Center on December 13, 2011, 11:56:56 am
not sure, but from the image it looks like the width of the checkbox is very small, maybe thats it. or maybe just a dumb remark :P

but you rock cant wait to support android with this :)
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: LA.Center on December 13, 2011, 12:00:20 pm
@felipemdc
on a different note but related, I successfully used vg_scene controls to create a iOS app, do you think we could use vg_scene also for android like a lib and start the lib from java jni?

I am asking because you already work a lot around this subject and maybe your answer will save me like 30 hours of testing :)
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 13, 2011, 01:11:39 pm
Yes, indeed it the checkbox was too small. The autosizing was happening before Activity.OnCreate and also before JNI_OnLoad, so it was too early and it could not communicate with the Java to get the text measurement. I postponed Application.Run and now it works, I'll update the screenshot. I also improve a little bit text rendering.

@felipemdc
on a different note but related, I successfully used vg_scene controls to create a iOS app, do you think we could use vg_scene also for android like a lib and start the lib from java jni?

I am asking because you already work a lot around this subject and maybe your answer will save me like 30 hours of testing :)

What is vg_scene? Does it work on top of OpenGL ES?
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: joseme on December 13, 2011, 03:07:09 pm
Hello.
vg_scene was a product from KSDev, a good graphic library for Delphi and Lazarus. Sadly, Embarcadero bought KSDev, and the library is no longer being sold.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: LA.Center on December 13, 2011, 03:17:26 pm
yes, we actually wrote a complete new one called 3FX, I have to admit we were very inspired by KSDev but we wrote everything from scratch and eliminated the complexity, and since vg_scene is also not supported anymore it was the only way to go.

My test was actually with 3FX, I just wrote vg_scene to make it more obvious to what I meant. And yes it is based on OpenGL ES, but I am not sure if it would work on Android.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 13, 2011, 03:36:08 pm
My test was actually with 3FX, I just wrote vg_scene to make it more obvious to what I meant. And yes it is based on OpenGL ES, but I am not sure if it would work on Android.

It should work fine in Android as it supports both OpenGL ES 1.1 and 2.0

You can either use native activity (Pascal example in lazarus-ccr/bindings/android-ndk/opengltest) or go for JNI (Pascal example in lazarus-ccr/bindings/android-ndk/jnitest also LCL-CustomDrawn-Android runs via JNI)

Which way is better is something hard to say, you can try both. I liked JNI more, mostly because the LCL needs to access many SDK APIs, but for an OpenGL application maybe Native Activity is better.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 14, 2011, 03:35:26 pm
Now TLabel and TTimer work too. TCDEdit already shows and the caret blinks. I started text input, but it isn't yet working in TCDEdit. And the virtual keyboard support also needs to be added.

When I started LCL-Android I was skeptical that it could be finished anytime soon and I instead planned on porting my apps to Android by using the Android SDK APIs directly via those Pascal bindings that I had built. But now LCL-CustomDrawn-Android is advancing so fast that I am changing my plans, I'll scrap porting to the SDK APIs and instead use the LCL for all my mobile apps =)
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: IndianaJones on December 17, 2011, 11:17:48 am

Hi Felipe,
I have just tried to compile the androidlcltest but it complains that error.

/usr/local/bin/arm-linux-ld: cannot find -ljnigraphics

Can you give any hint what is that error related with?
Thanks.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 17, 2011, 03:33:15 pm
The instructions were not 100% clear, but now I have expanded considerably the instructions here:

http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android#Compiling_the_example_LCL_Android_Application

In your particular case you need to change the libraries path to reflect your NDK, as explained in Step 2.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: IndianaJones on December 17, 2011, 07:03:32 pm

Thanks for the link Felipe, I have compiled the example with Mac OS X 10.6 and tested under Google Nexus one. It looks wonderful, great progress.
Besides this the Form components look a little bit smaller for the Nexus one screen and keyboard doesnt work for Edit field.
Congratulations.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 17, 2011, 07:14:48 pm
Thanks =)

Besides this the Form components look a little bit smaller for the Nexus one screen

That's a known missing feature. I will very soon implement DPI Awareness in the LCL, so it will auto-adjust the entire layout for the phone. It will measure your phone width and adjust stretch all controls which have Align=alNone and normal anchors so that they will fit the width without horizontal scrolling.

Then it will stretch all font sizes and all controls Y axis for the DPI, considering your design DPI as 96 it will increase a lot the Y axis for Android phones which have DPIs from 140 to 400...

Effectively the fixed layout which people use with Lazarus will be reinterpreted as a grid layout where what you choose in the X axis is only a percentage of the form Width and what you choose in the Y axis is a value in pixels for the DPI stored in TApplication.DesignTimeDPI (or something similar) which will be stretched if the DPI of the target device does not match it. It will be possible to turn this feature off.

If you check Forms.pp in Lazarus SVN there is already:

Code: [Select]
  TLayoutAdjustmentPolicy = (
    lapDefault,     // widgetset dependent
    lapFixedLayout, // A fixed absolute layout in all platforms
    lapAutoAdjustWithoutHorizontalScrolling, // Smartphone platforms use this one,
                                             // the x axis is stretched to fill the screen and
                                             // the y is scaled to fit the DPI
    lapAutoAdjustForDPI // For desktops using High DPI, scale x and y to fit the DPI
  );

Quote
and keyboard doesnt work for Edit field.

But the virtual keyboard shows, correct? If yes, it is a known bug. OnKeyDown / OnKeyUp is received correctly. I think that OnKeyPress too. It should be easy to fix as soon as I find some time to debug this.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: IndianaJones on December 17, 2011, 08:41:44 pm

Yes, the virtual keyboard shown as expected and my second examination I found the bug or mistake.
When you first activate or focused to TEdit component the virtual keyboard doesnt work as expected (but shown) after the second touch (mean focused) the virtual keyboard works fine.

Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: LA.Center on December 19, 2011, 02:21:09 pm
@felipemdc

Check your PM, we have a proposition for you :)
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 19, 2011, 02:54:45 pm
Yes, the virtual keyboard shown as expected and my second examination I found the bug or mistake.
When you first activate or focused to TEdit component the virtual keyboard doesnt work as expected (but shown) after the second touch (mean focused) the virtual keyboard works fine.

It would be cool if you could check now if the controls are good sized in your device. I just implemented layout auto-adjustment for DPI and form width.

I get issues here with it:

1> First screen rotation does not execute unless I click the screen. very wierd.
2> The secondary form seams to adjust its DPI correctly but not width, but the log doesnt show anything wrong.

The next step now is implementing form scrolling.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 19, 2011, 03:08:13 pm
1> First screen rotation does not execute unless I click the screen. very wierd.

I fixed this in rev 34280 by changing from SurfaceView to View.

2> The secondary form seams to adjust its DPI correctly but not width, but the log doesnt show anything wrong.

I fixed this in rev 34281

Ok, so now missing stuff are:

1> Implement form scrolling
2> Fix TCDEdit (it has a number of bugs)
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: IndianaJones on December 19, 2011, 06:41:17 pm

I have tested the last release, here is the adb logcat output.

D/dalvikvm( 2425): GC_EXPLICIT freed 22K, 49% free 2774K/5379K, external 1625K/2137K, paused 55ms
W/KeyCharacterMap(  156): No keyboard for id 131074
W/KeyCharacterMap(  156): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
V/RenderScript_jni(  177): surfaceCreated
V/RenderScript_jni(  177): surfaceChanged
D/dalvikvm( 2593): GC_EXPLICIT freed 12K, 49% free 3729K/7175K, external 1625K/2137K, paused 235ms
I/ActivityManager(   92): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.pascal.lcltest/.LCLActivity } from pid 177
I/ActivityManager(   92): Start proc com.pascal.lcltest for activity com.pascal.lcltest/.LCLActivity: pid=2946 uid=10072 gids={}
I/lclapp  ( 2946): Trying to load liblclapp.so
D/dalvikvm( 2946): Trying to load lib /data/data/com.pascal.lcltest/lib/liblclapp.so 0x405145e0
I/lclapp  ( 2946): [TCDWSCustomCheckBox.GetPreferredSize] Width=21 Height=15
I/lclapp  ( 2946): [FORMS.PP] ExceptionOccurred
I/lclapp  ( 2946):   Sender=EIntOverflow
I/lclapp  ( 2946):   Exception=Arithmetic overflow
I/lclapp  ( 2946):   Stack trace:
I/lclapp  ( 2946):   $8096B1C8
I/lclapp  ( 2946): TApplication.HandleException Arithmetic overflow
I/lclapp  ( 2946):   Stack trace:
I/lclapp  ( 2946):   $8096B1C8
I/ActivityManager(   92): Process com.pascal.lcltest (pid 2946) has died.
V/RenderScript_jni(  177): surfaceDestroyed
W/InputManagerService(   92): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@409a5340
V/RenderScript_jni(  177): surfaceCreated
V/RenderScript_jni(  177): surfaceChanged
W/InputManagerService(   92): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40a544f8

P.S. How can I get androidlcl svn instead of getting lazarus svn?

Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 19, 2011, 07:28:09 pm
I have tested the last release, here is the adb logcat output.

release? What do you mean? Which revision are you using exactly?

Quote
P.S. How can I get androidlcl svn instead of getting lazarus svn?

They are the same thing. Note that you need to update the entire Lazarus tree, because the example changes sometimes too, not only the lcl.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: IndianaJones on December 19, 2011, 08:57:04 pm

I mean revision(feel a little bit sleepy)  %) here is the revision info.

Path: lazarus
URL: http://svn.freepascal.org/svn/lazarus/trunk
Repository Root: http://svn.freepascal.org/svn/lazarus
Repository UUID: 4005530d-fff6-0310-9dd1-cebe43e6787f
Revision: 34286
Node Kind: directory
Schedule: normal
Last Changed Author: mattias
Last Changed Rev: 34286
Last Changed Date: 2011-12-19 19:15:44 +0200 (Mon, 19 Dec 2011)
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 19, 2011, 09:16:11 pm
Could you add -dVerboseCDWinAPI to the package LCL and rebuild it and show what the log shows then? Strange, in my Wildfire and in the emulator I don't get this error.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: herux on December 20, 2011, 04:15:51 am
hello felipe,
I've just update lazarus from svn. but I still get the same error as yesterday week. I got the following error logs, can you tell me what cause this to happen?

Code: [Select]
12-20 10:00:31.609: I/ActivityManager(164): Start proc com.pascal.lcltest for activity com.pascal.lcltest/.LCLActivity: pid=5272 uid=10074 gids={}
12-20 10:00:31.619: I/AndroidRuntime(5264): NOTE: attach of thread 'Binder Thread #3' failed
12-20 10:00:31.739: I/lclapp(5272): Trying to load liblclapp.so
12-20 10:00:32.149: I/ggheart(623): onStop
12-20 10:00:32.149: I/lclapp(5272): JNI_OnLoad called
12-20 10:00:32.149: I/lclapp(5272): Reading our Activity Class
12-20 10:00:32.149: I/lclapp(5272): JNI_OnLoad finished
12-20 10:00:32.159: I/ApplicationPackageManager(5272): cscCountry is not German : XSE
12-20 10:00:32.179: I/lclapp(5272): LCLOnCreate called by LCLActivity.onCreate
12-20 10:00:32.179: I/lclapp(5272): [FORMS.PP] ExceptionOccurred
12-20 10:00:32.179: I/lclapp(5272):   Sender=ERangeError
12-20 10:00:32.179: I/lclapp(5272):   Exception=Range check error
12-20 10:00:32.179: I/lclapp(5272):   Stack trace:
12-20 10:00:32.179: I/lclapp(5272):   $810E4F0C
12-20 10:00:32.179: I/lclapp(5272): TApplication.HandleException Range check error
12-20 10:00:32.179: I/lclapp(5272):   Stack trace:
12-20 10:00:32.179: I/lclapp(5272):   $810E4F0C
12-20 10:00:32.239: I/ActivityManager(164): Process com.pascal.lcltest (pid 5272) has died.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 20, 2011, 04:46:23 am
I've just update lazarus from svn. but I still get the same error as yesterday week. I got the following error logs, can you tell me what cause this to happen?

Which compiler are you using? Did you add range checking to your LCL compilation? Do you have local modifications? Try svn diff to check this.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: herux on December 20, 2011, 05:52:09 am
Quote
Which compiler are you using?

Using 2.5.1 :

Free Pascal Compiler version 2.5.1 [2011/01/19] for arm
Copyright (c) 1993-2010 by Florian Klaempfl
/home/herux/Documents/fpc-2.5.1.arm-linux/lib/fpc/2.5.1/ppcrossarm

Quote
Did you add range checking to your LCL compilation?

you mean -Cr ? no

Quote
Do you have local modifications?

no. but I will see it and try again.

thanks
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 20, 2011, 08:22:08 am
In this case could you add -dVerboseCDWinAPI -dVerboseCDDrawing to the package LCL and rebuild it and show what the log shows then? It looks like it crashes inside onCreate.

Which device do you use?

Could you test in the emulator?
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 20, 2011, 10:26:31 am
I just tested in Nexus One Android 2.2 and it works normally ... probably you guys are having a configuration problem. Maybe forgot to build the library too, built only via ant.

To help solve this puzzle I attached a snapshot of the LCL Example APK here: https://sourceforge.net/projects/p-tools/files/Android%20LCL%20Example%20Snapshot/?

It would be good to know if it works. If it doesnt then we really have a bug, maybe specific to a particular device. If it works, it is a build environment configuration issue.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: herux on December 20, 2011, 11:52:26 am
I have downloaded your apk, and yes it work on my emulator android 2.2 and on my device Samsung GIO android 2.3.

I add -dVerboseCDWinAPI -dVerboseCDDrawing, like you said
and here is the error log, still the same .. happened in my emulator or device
Code: [Select]
12-20 17:37:46.939: I/lclapp(6756): Trying to load liblclapp.so
12-20 17:37:47.129: I/PowerManagerService(164): Light Animator Finished curIntValue=20
12-20 17:37:47.369: I/lclapp(6756): JNI_OnLoad called
12-20 17:37:47.369: I/lclapp(6756): Reading our Activity Class
12-20 17:37:47.369: I/lclapp(6756): JNI_OnLoad finished
12-20 17:37:47.369: I/ApplicationPackageManager(6756): cscCountry is not German : XSE
12-20 17:37:47.379: I/lclapp(6756): LCLOnCreate called by LCLActivity.onCreate
12-20 17:37:47.379: I/lclapp(6756): [FORMS.PP] ExceptionOccurred
12-20 17:37:47.379: I/lclapp(6756):   Sender=ERangeError
12-20 17:37:47.379: I/lclapp(6756):   Exception=Range check error
12-20 17:37:47.379: I/lclapp(6756):   Stack trace:
12-20 17:37:47.379: I/lclapp(6756):   $810E5340
12-20 17:37:47.379: I/lclapp(6756): TApplication.HandleException Range check error
12-20 17:37:47.379: I/lclapp(6756):   Stack trace:
12-20 17:37:47.379: I/lclapp(6756):   $810E5340
12-20 17:37:47.429: I/ActivityManager(164): Process com.pascal.lcltest (pid 6756) has died.

I build an APK using eclipse.
Maybe you need to know, I use FreePascal 2.6 for Ubuntu 11.10 x64, but using 2.5.1 for arm. does this matter?
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 20, 2011, 12:54:42 pm
I build an APK using eclipse.

Don't use Eclipse, instead use the instructions here:

http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android#Compiling_the_example_LCL_Android_Application

Follow all steps.

Quote
Maybe you need to know, I use FreePascal 2.6 for Ubuntu 11.10 x64, but using 2.5.1 for arm. does this matter?

No, multiple compilers can live together if they target different architectures.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: herux on December 20, 2011, 05:37:41 pm
I built it with ant and error still the same.

Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: IndianaJones on December 20, 2011, 08:19:56 pm

I compiled the app with these -dVerboseCDWinAPI -dVerboseCDDrawing parameters. An here is the output of the adb logcat output.

V/RenderScript_jni(  177): surfaceCreated
V/RenderScript_jni(  177): surfaceChanged
I/ActivityManager(   92): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.pascal.lcltest/.LCLActivity } from pid 177
I/ActivityManager(   92): Start proc com.pascal.lcltest for activity com.pascal.lcltest/.LCLActivity: pid=5453 uid=10072 gids={}
I/lclapp  ( 5453): Trying to load liblclapp.so
D/dalvikvm( 5453): Trying to load lib /data/data/com.pascal.lcltest/lib/liblclapp.so 0x40513f40
I/lclapp  ( 5453): :>[WinAPI GetDC] hWnd: 0
I/lclapp  ( 5453): :>[WinAPI GetDeviceCaps] DC 446AC020
I/lclapp  ( 5453): [WinAPI SetProp win=TCDNonNativeForm str=WinControl data=44667AD0
I/lclapp  ( 5453): [WinAPI SetProp win=TCDWinControl str=WinControl data=44667F60
I/lclapp  ( 5453): [WinAPI SetProp win=TCDWinControl str=WinControl data=446682C0
I/lclapp  ( 5453): [WinAPI SetProp win=TCDWinControl str=WinControl data=44668620
I/lclapp  ( 5453): [WinAPI SetProp win=TCDWinControl str=WinControl data=44669070
I/lclapp  ( 5453): [WinAPI SetProp win=TCDWinControl str=WinControl data=44668990
I/lclapp  ( 5453): [WinAPI SetProp win=TCDWinControl str=WinControl data=44669400
I/lclapp  ( 5453): [WinAPI SetProp win=TCDWinControl str=WinControl data=44669F80
I/lclapp  ( 5453): [WinAPI SetProp win=TCDWinControl str=WinControl data=4466A2E0
I/lclapp  ( 5453): [WinAPI SetProp win=TCDWinControl str=WinControl data=4466A640
I/lclapp  ( 5453): [WinAPI SetProp win=TCDWinControl str=WinControl data=44668D20
I/lclapp  ( 5453): [WinAPI SetProp win=TCDWinControl str=WinControl data=446697B0
I/lclapp  ( 5453): :>[WinAPI GetDC] hWnd: 4462E8A0
I/lclapp  ( 5453): :<[WinAPI GetDC] Result: 446AC020
I/lclapp  ( 5453): [TCDWidgetSet.CreateFontIndirectEx]  LongFontName: default
I/lclapp  ( 5453): :>[TCDWidgetSet.SelectObject] DC=446AC020 GDIObj=44644F60
I/lclapp  ( 5453): :<[TCDWidgetSet.SelectObject] Result=0 ObjectType=
I/lclapp  ( 5453): [TCDWidgetSet.SetTextColor]  DC: 446AC020 Color: 80000012
I/lclapp  ( 5453): [TCDWSCustomCheckBox.GetPreferredSize] Width=21 Height=15
I/lclapp  ( 5453): :>[WinAPI GetDC] hWnd: 446449A0
I/lclapp  ( 5453): :<[WinAPI GetDC] Result: 446AC020
I/lclapp  ( 5453): :>[TCDWidgetSet.SelectObject] DC=446AC020 GDIObj=44644F60
I/lclapp  ( 5453): :<[TCDWidgetSet.SelectObject] Result=0 ObjectType=
I/lclapp  ( 5453): [FORMS.PP] ExceptionOccurred
I/lclapp  ( 5453):   Sender=EIntOverflow
I/lclapp  ( 5453):   Exception=Arithmetic overflow
I/lclapp  ( 5453):   Stack trace:
I/lclapp  ( 5453):   $8096DE44
I/lclapp  ( 5453): TApplication.HandleException Arithmetic overflow
I/lclapp  ( 5453):   Stack trace:
I/lclapp  ( 5453):   $8096DE44
Press Cancel to kill the program. lpCaption=app_process uType=17 lpText=Arithmetic overflow.
I/lclapp  ( 5453): Trace:> [WinAPI DeleteObject] GDIObject: 44644F60
I/lclapp  ( 5453): Trace:< [WinAPI DeleteObject] Result=True ObjectType=Font
I/ActivityManager(   92): Process com.pascal.lcltest (pid 5453) has died.
W/WindowManager(   92): Rebuild removed 5 windows but added 4
W/InputManagerService(   92): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@4062e808

Here are some additional info:
Path: lazarus
URL: http://svn.freepascal.org/svn/lazarus/trunk
Repository Root: http://svn.freepascal.org/svn/lazarus
Repository UUID: 4005530d-fff6-0310-9dd1-cebe43e6787f
Revision: 34328
Node Kind: directory
Schedule: normal
Last Changed Author: juha
Last Changed Rev: 34328
Last Changed Date: 2011-12-20 19:45:13 +0200 (Tue, 20 Dec 2011)
--------------------------------------------------------------------------------------------------
Path: fpc2.5.1
URL: http://svn.freepascal.org/svn/fpc/trunk
Repository Root: http://svn.freepascal.org/svn/fpc
Repository UUID: 3ad0048d-3df7-0310-abae-a5850022a9f2
Revision: 16790
Node Kind: directory
Schedule: normal
Last Changed Author: jonas
Last Changed Rev: 16786
Last Changed Date: 2011-01-19 16:50:17 +0200 (Wed, 19 Jan 2011)
--------------------------------------------------------------------------------------------------
Android Version
2.3.6
--------------------------------------------------------------------------------------------------
NDK-R7 / Android-14

Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 20, 2011, 10:33:10 pm
For both of you:

Try to get the address of the place where the exception happens. I Google a bit and it seams that this should do it:

[felipe@localhost android]$ ~/Programas/android-ndk-r5/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi-addr2line -f -e libs/armeabi/liblclapp.so 8096DE44

But in my tests it didn't work. Probably our addresses are different, no idea.

You need to rebuild the project with debug info, I'll add a debug build mode in svn.

To herux:

You didn't rebuild the shared object in Lazarus, or didn't do it correctly or it failed to write the .so file or something like that. It is impossible that you will rebuild the LCL with -dVerboseCDWinAPI and it won't show debug info because it uses WinAPIs in the library initialization.

To IndianaJones:

Does my APK work in your device?
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: IndianaJones on December 24, 2011, 03:26:30 pm

Hi Felipe,
I have tested with the revision 34384 and it works normal now except with a simple deficients.
Thanks.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 24, 2011, 07:26:27 pm
I have tested with the revision 34384 and it works normal now except with a simple deficients.

Yes, I see that the text drawing buffer bitmap is a little bit too small in the X axis. But it uses the size send by the Android Text API... looks like it lies. Good to know that everywhere it seams to get the same factor of wrongness. I think I'll just add a +5 pixels factor in the width or something like that.

About TCDEdit there is still some stuff to be fixed, although I already fixed 1 bug these last days.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on December 25, 2011, 12:03:00 pm
Hello, Could you retest and send a new screenshot? I added a factor (I think 3 pixels for DPI 125), and made it adjust to the font size, so the factor will be slightly larger in your device I think.

I also found and fixed another TCDEdit bug, but there are still some issues. But it is surely improving.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: IndianaJones on December 25, 2011, 02:33:57 pm

Tested with the 34403, looks cool.  :D
P.S. Keyboard doesnt work in the Edit field again.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: wcleyton on January 20, 2012, 01:31:11 pm
Hi,

 I'm trying to compile the example. When I install the emulator, the following error appears:

Code: [Select]
D/AndroidRuntime(  300): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime(  300): CheckJNI is ON
D/AndroidRuntime(  300): --- registering native functions ---
D/dalvikvm(  255): GC_EXPLICIT freed 81 objects / 4496 bytes in 133ms
D/PackageParser(   59): Scanning package: /data/app/vmdl62149.tmp
D/PackageManager(   59): Scanning package com.pascal.lcltest
I/PackageManager(   59): /data/app/com.pascal.lcltest-1.apk changed; unpacking
D/PackageManager(   59): Caching shared lib lib/armeabi/liblclapp.so
D/installd(   35): DexInv: --- BEGIN '/data/app/com.pascal.lcltest-1.apk' ---
D/dalvikvm(  307): DexOpt: load 68ms, verify 75ms, opt 4ms
D/installd(   35): DexInv: --- END '/data/app/com.pascal.lcltest-1.apk' (success
) ---
D/PackageManager(   59):   Activities: com.pascal.lcltest.LCLActivity
I/ActivityManager(   59): Force stopping package com.pascal.lcltest uid=10036
I/installd(   35): move /data/dalvik-cache/data@app@com.pascal.lcltest-1.apk@cla
sses.dex -> /data/dalvik-cache/data@app@com.pascal.lcltest-1.apk@classes.dex
D/PackageManager(   59): New package installed in /data/app/com.pascal.lcltest-1
.apk
D/dalvikvm(   59): GC_EXPLICIT freed 7186 objects / 432496 bytes in 210ms
D/AndroidRuntime(  300): Shutting down VM
D/jdwp    (  300): adbd disconnected
I/dalvikvm(  300): JNI: AttachCurrentThread (from ???.???)
I/AndroidRuntime(  300): NOTE: attach of thread 'Binder Thread #3' failed
W/RecognitionManagerService(   59): no available voice recognition services foun
d
D/dalvikvm(  274): GC_EXPLICIT freed 752 objects / 54528 bytes in 147ms
D/dalvikvm(  255): GC_EXPLICIT freed 88 objects / 8104 bytes in 201ms
I/ActivityManager(   59): Starting activity: Intent { act=android.intent.action.
MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.pascal.lcltes
t/.LCLActivity }
I/ActivityManager(   59): Start proc com.pascal.lcltest for activity com.pascal.
lcltest/.LCLActivity: pid=311 uid=10036 gids={}
I/lclapp  (  311): Trying to load liblclapp.so
D/dalvikvm(  311): Trying to load lib /data/data/com.pascal.lcltest/lib/liblclap
p.so 0x44ede248
I/dalvikvm(  311): Unable to dlopen(/data/data/com.pascal.lcltest/lib/liblclapp.
so): Cannot load library: link_image[1995]: failed to link liblclapp.so
I/dalvikvm(  311):
E/lclapp  (  311): WARNING: Could not load liblclapp.so
W/System.err(  311): java.lang.UnsatisfiedLinkError: Library lclapp not found
W/System.err(  311):    at java.lang.Runtime.loadLibrary(Runtime.java:461)
W/System.err(  311):    at java.lang.System.loadLibrary(System.java:557)
W/System.err(  311):    at com.pascal.lcltest.LCLActivity.<clinit>(LCLActivity.j
ava:594)
W/System.err(  311):    at java.lang.Class.newInstanceImpl(Native Method)
W/System.err(  311):    at java.lang.Class.newInstance(Class.java:1429)
W/System.err(  311):    at android.app.Instrumentation.newActivity(Instrumentati
on.java:1021)
W/System.err(  311):    at android.app.ActivityThread.performLaunchActivity(Acti
vityThread.java:2577)
W/System.err(  311):    at android.app.ActivityThread.handleLaunchActivity(Activ
ityThread.java:2679)
W/System.err(  311):    at android.app.ActivityThread.access$2300(ActivityThread
.java:125)
W/System.err(  311):    at android.app.ActivityThread$H.handleMessage(ActivityTh
read.java:2033)
W/System.err(  311):    at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(  311):    at android.os.Looper.loop(Looper.java:123)
W/System.err(  311):    at android.app.ActivityThread.main(ActivityThread.java:4
627)
W/System.err(  311):    at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(  311):    at java.lang.reflect.Method.invoke(Method.java:521)
W/System.err(  311):    at com.android.internal.os.ZygoteInit$MethodAndArgsCalle
r.run(ZygoteInit.java:868)
W/System.err(  311):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.ja
va:626)
W/System.err(  311):    at dalvik.system.NativeStart.main(Native Method)
W/dalvikvm(  311): No implementation found for native Lcom/pascal/lcltest/LCLAct
ivity;.LCLOnCreate (Lcom/pascal/lcltest/LCLActivity;)I
D/AndroidRuntime(  311): Shutting down VM
W/dalvikvm(  311): threadid=1: thread exiting with uncaught exception (group=0x4
001d800)
E/AndroidRuntime(  311): FATAL EXCEPTION: main
E/AndroidRuntime(  311): java.lang.UnsatisfiedLinkError: LCLOnCreate
E/AndroidRuntime(  311):        at com.pascal.lcltest.LCLActivity.LCLOnCreate(Na
tive Method)
E/AndroidRuntime(  311):        at com.pascal.lcltest.LCLActivity.onCreate(LCLAc
tivity.java:203)
E/AndroidRuntime(  311):        at android.app.Instrumentation.callActivityOnCre
ate(Instrumentation.java:1047)
E/AndroidRuntime(  311):        at android.app.ActivityThread.performLaunchActiv
ity(ActivityThread.java:2627)
E/AndroidRuntime(  311):        at android.app.ActivityThread.handleLaunchActivi
ty(ActivityThread.java:2679)
E/AndroidRuntime(  311):        at android.app.ActivityThread.access$2300(Activi
tyThread.java:125)
E/AndroidRuntime(  311):        at android.app.ActivityThread$H.handleMessage(Ac
tivityThread.java:2033)
E/AndroidRuntime(  311):        at android.os.Handler.dispatchMessage(Handler.ja
va:99)
E/AndroidRuntime(  311):        at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  311):        at android.app.ActivityThread.main(ActivityThrea
d.java:4627)
E/AndroidRuntime(  311):        at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime(  311):        at java.lang.reflect.Method.invoke(Method.java:5
21)
E/AndroidRuntime(  311):        at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime(  311):        at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:626)
E/AndroidRuntime(  311):        at dalvik.system.NativeStart.main(Native Method)

W/ActivityManager(   59):   Force finishing activity com.pascal.lcltest/.LCLActi
vity
W/ActivityManager(   59): Activity pause timeout for HistoryRecord{44ff5d70 com.
pascal.lcltest/.LCLActivity}
I/Process (  311): Sending signal. PID: 311 SIG: 9
I/ActivityManager(   59): Process com.pascal.lcltest (pid 311) has died.
W/InputManagerService(   59): Window already focused, ignoring focus gain of: co
m.android.internal.view.IInputMethodClient$Stub$Proxy@45063ab0
W/ActivityManager(   59): Activity destroy timeout for HistoryRecord{44ff5d70 co
m.pascal.lcltest/.LCLActivity}
D/SntpClient(   59): request time failed: java.net.SocketException: Address fami
ly not supported by protocol
D/SntpClient(   59): request time failed: java.net.SocketException: Address fami
ly not supported by protocol
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on January 20, 2012, 02:07:04 pm
Please start a new thread about this, this one is getting messy. Repeat your previous post and also describe step-by-step what you are doing to build the project and how you configured your build environment.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: woma1 on January 22, 2012, 02:04:08 pm
Hi.

I have several questions:

1. Is it possible to build in Lazarus under Windows apps for Android? On the "http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android" Although it is described, but the documentation is quite incomplete.

2. If the point 1, the answer is Yes, then if someone could create a complete and detailed documentation?

3. Whether and how can I customize other controls Lazarus for use in applications for Android. I mean mainly the control of access to data. Maybe someone in this issue will create a detailed documentation?

The text translated by Google!

DUDUS
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: BlueIcaro on January 22, 2012, 03:28:51 pm
Hi.

I have several questions:

1. Is it possible to build in Lazarus under Windows apps for Android? On the "http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android" Although it is described, but the documentation is quite incomplete.
(...)
DUDUS

I think, for the moment, the best solution is download the virtual machine that builded Felipe. It's a virtual machine of a lunux distro, with every thing you need to start.

I downloaded it and works fine in windows.

In this issue you have all information: http://www.lazarus.freepascal.org/index.php/topic,15616.0.html (http://www.lazarus.freepascal.org/index.php/topic,15616.0.html)
/BlueIcaro
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on January 22, 2012, 03:55:15 pm
1. Is it possible to build in Lazarus under Windows apps for Android?

Yes.

Quote
2. If the point 1, the answer is Yes, then if someone could create a complete and detailed documentation?

If you have special requirements which are not fullfilled by what is already provided (like the Linux pre-compiled compiler or the Linux VM Image) then maybe you should try a bounty:

http://wiki.lazarus.freepascal.org/Bounties

Quote
3. Whether and how can I customize other controls Lazarus for use in applications for Android. I mean mainly the control of access to data. Maybe someone in this issue will create a detailed documentation?

Which controls exactly? But in general, LCL for Android is exactly identical to the LCL for any other platform. Customizations are mostly unnecessary. Data base access is documented here:

http://wiki.lazarus.freepascal.org/Databases

http://wiki.lazarus.freepascal.org/Lazarus_Database_Tutorial

The Lazarus book in english also covers a lot of information about database programming in Lazarus / FPC.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: jmpessoa on January 22, 2012, 09:19:27 pm
Hi Felipe,

There are a plan for  TCDTreeView and TCDToolBar on "Custom Drawn",
my question is about future
requirement for porting for android.... this is True?
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on January 22, 2012, 09:27:52 pm
There are a plan for  TCDTreeView and TCDToolBar on "Custom Drawn",
my question is about future
requirement for porting for android.... this is True?

TTreeView is custom drawn by nature and descends from TCustomControl. So it does not require a TCD* control to work. TToolbar is also a descendent from TCustomControl, but I don't know if it requires a widgetset implementation or not. Maybe they even already work in Android, one needs to test. And if they don't work one needs to investigate which LCL features they require which are missing.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: woma1 on January 23, 2012, 06:37:53 pm
Hi

I program in Delphi for many years, and are unlikely to need additional documentation. Specifically I'm interested how can I use in Android application:
TDatasource;
TDBGrid;
TSQLite3Connection;
TSQLQuery;

DUDUS
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on January 23, 2012, 07:27:10 pm
I program in Delphi for many years, and are unlikely to need additional documentation. Specifically I'm interested how can I use in Android application:
TDatasource;
TSQLite3Connection;
TSQLQuery;

Those are non-visual controls. They will work out of the box and there is nothing specific about Android in their usage in Pascal, but there is 1 thing special about the linking: you need to get a cross-compiled sqlite library and place it in an appropriate version for the linker to find. Sqlite does not come pre-installed in Android. If you want to know how to use them then you should read the wiki database articles which I previously linked or the Lazarus book and when you have more specific questions post in the Database section of this forum.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: wcleyton on January 23, 2012, 08:02:28 pm
Hi,

 You can change the font color of the Label?

 I changed the color of the label to red. Only when running on the emulator, it was black.

 Note: I re-compiled and installed again the example in the emulator. Even added a few more buttons to make sure it was updating the compilation.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on January 23, 2012, 08:36:34 pm
Indeed text color is missing, please open a bug report. It should be easy to add.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on January 24, 2012, 11:44:29 am
The bug report is no longer needed, I implemented text color in rev 34893
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: wcleyton on January 24, 2012, 11:49:48 am
Hi felipe,

Added the Bug: 0021144.

Then I saw that you had already corrected.  :-[
 
Thank you
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: wcleyton on January 26, 2012, 11:33:08 am
Hi,

 When I add a USES clause in the code, the example no longer runs on the emulator.

 For example, I added only in the USES Unit DBF (wanted to do a test with DBF files).

 interface

 uses
   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
   LCLProc, Arrow, StdCtrls, ComCtrls, LCLType, LCLIntf, InterfaceBase, DBF;

 When I run the example on the emulator, nothing appears. logcat appears in:

 I / lclapp (273): Trying to load liblclapp.so
 D / dalvikvm (273): Trying to load lib / data / data / com.pascal.lcltest / lib / liblclap
 p.so 0x44ede248
 I / lclapp (273): [FORMS.PP] ExceptionOccurred
 I / lclapp (273): = Sender Exception
 I / lclapp (273): Exception = Unknown Run-Time error: 202
 I / lclapp (273): Stack trace:
 I / lclapp (273): $ 810E6B84
 I / lclapp (273): Unknown TApplication.HandleException Run-Time error: 202
 I / lclapp (273): Stack trace:
 I / lclapp (273): $ 810E6B84
 D / Zygote (33): Process 273 exited cleanly (217)

 If I remove the unit's USES DBF and compile the example runs normally.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on January 26, 2012, 11:46:35 am
Run-Time error 202 is Stack Overflow: http://www.freepascal.org/docs-html/user/userap4.html

Very strange, it looks like that DBF was not properly tested in the ARM processor. Maybe it has a too long recursion or something like that...
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: wcleyton on January 26, 2012, 12:30:43 pm
I had this problem when running the example without any changes and realized I was with the option (Stack)-Ct enabled.

Disabling this option runs the example-Ct.

I did another test. Unit removed the DBF and just added a DataSource. The example also does not run on emulator.

Do I have to recompile the libraries with this option lazarus-Ct?
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on January 26, 2012, 12:52:10 pm
No idea, you should start a new thread to discuss this topic. Maybe a fpc developer will know more about this.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: LA.Center on January 27, 2012, 10:10:07 pm
hi felipemdc, I just downloaded your VirtualBox Image, can you please share the sudo password, I need to map a shared drive.

Also, is there a list of components that are supported by LCL Android?

Very well done, like I always say, you the man :)

PS: I just read in a other thread that custom draw controls with themed paiting, can we apply android painting to LCLAndroid?
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: mdalacu on January 30, 2012, 07:04:11 am
The password is 'root'.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on January 30, 2012, 07:27:28 am
thanks =)

Also, is there a list of components that are supported by LCL Android?

http://wiki.lazarus.freepascal.org/Roadmap

Quote
PS: I just read in a other thread that custom draw controls with themed paiting, can we apply android painting to LCLAndroid?

Android painting is not finished yet, so I think it won't be very helpful in the current stage. But for your information, other drawers are currently in the components/customdrawn package, so just add this package as a requirement for your project, add any drawers that you want to try to your uses clause and then in the beginning of the application set the DefaultDrawer (or similar name of a variable from customdrawndrawers.pas) to the desired value.
Title: Re: LCL-CustomDrawn substitutes LCL-Android
Post by: felipemdc on January 30, 2012, 08:09:25 am
I am locking this topic because it is getting too much of a mess, please ask questions in separate topics in the Android sub-section of the forum.
TinyPortal © 2005-2018