Android Module Wizard lazarus / 43-Android ---------------------------------------------------------------------- jmpessoa · 2013-09-01 14:35 Lazarus Android Module Wizard                  "Form Designer and Components development model!"    "A wizard to create JNI Android loadable module (.so) in Lazarus/Free Pascal using    [datamodule like] Form Designer and Components!"    Author: Jose Marques Pessoa : jmpessoa__hotmail_com       https://github.com/jmpessoa/lazandroidmodulewizard Please, to start:    "readme.txt"    "install_tutorial_ant_users.txt"    "install_tutorial_eclipse_users.txt" Acknowledgements: Eny and Phil for the Project wizard hints...                   http://forum.lazarus.freepascal.org/index.php/topic, 20763.msg120823.html#msg120823                   Felipe for Android support....                   TrueTom for Laz4Android Package (laz4android1.1-41139)...                   https://skydrive.live.com/?cid=89ae6b50650182c6&id=8 9AE6B50650182C6%21149                   Lazarus forum community! version 0.1 - August 2013 [1]Warning: at the moment this code is just a *proof-of-concept* I. INSTALL LAZARUS PACKAGE (laz4android1.1-41139)    1. From lazarus IDE       1.1 Package -> Open Package -> "lazandroidwizardpack.lpk"         1.2 From Package Wizard           1.2.1 Compile           1.2.2 Use -> Install II. USE 1. From Eclipse IDE   1.1. File -> New -> Android Application Project   1.2. From Package Explore -> src            Right click your recent created package -> new -> class             Enter new class name... (ex. JNIHello)          Edit class code for wrapper native methods (ex...) Code: [Select]                 package org.jmpessoa.app1;   public class JNIHello {    public native String getString(int flag);    public native int getSum(int x, int y);                    static { try {           System.loadLibrary("jnihello");          } catch(UnsatisfiedLinkError ule) {     ule.printStackTrace(); }                    }              }    1.3. warning: System.loadLibrary("...") must match class Name lower case...        ex. JNIHello -> "jnihello" 2. From lazarus IDE (laz4android1.1-41139)    2.1 Project -> New Project    2.2 JNI Android Module 2.1. From JNI Android Module set Paths    2.1.1 Path to Eclipse Workspace        ex. C:\adt32\eclipse\workspace              2.1.2 Path to Ndk Plataforms        ex. C:\adt32\ndk7\platforms\android-8\arch-arm\usr\lib    2.1.3 Path to Ndk Toolchain         ex. C:\adt32\ndk7\toolchains\arm-linux- androideabi-4.4.3\prebuilt\windows\lib\gcc\arm-linux-androideabi\4.4.3 2.2. From JNI Android Module select Java wrapper class for native methods.... (ex JNIHello) 2.3. OK!  2.3.1 - Data Module Form Code: Code: [Select]{Hint: save all files to location: C:\adt32\eclipse\workspace\App1\jni } unit unit1;   {$mode objfpc}{$H+}   interface   uses   Classes, SysUtils;   type   TAndroidModule1 = class(TDataModule)     private       {private declarations}     public       {public declarations}   end;   var   AndroidModule1: TAndroidModule1; implementation   {$R *.lfm}   end. 2.3.2. Library Code: Code: [Select]{hint: save all files to location: C:\adt32\eclipse\workspace\App1\jni } library jnihello; {$mode delphi} uses   Classes, SysUtils, CustApp, jni, Unit1; const   curClassPathName: string='';   curClass: JClass=nil;   curVM: PJavaVM=nil;   curEnv: PJNIEnv=nil; type   TAndroidApplication = class(TCustomApplication)    public      procedure CreateForm(InstanceClass: TComponentClass; out Reference);      constructor Create(TheOwner: TComponent); override;      destructor Destroy; override;   end; procedure TAndroidApplication.CreateForm(InstanceClass: TComponentClass; out Reference); var   Instance: TComponent; begin   Instance := TComponent(InstanceClass.NewInstance);   TComponent(Reference):= Instance;   Instance.Create(Self); end; constructor TAndroidApplication.Create(TheOwner: TComponent); begin   inherited Create(TheOwner);   StopOnException:=True; end; destructor TAndroidApplication.Destroy; begin   inherited Destroy; end; var   Application: TAndroidApplication; { Class:     org_jmpessoa_app1_JNIHello   Method:    getString   Signature: (I)Ljava/lang/String; } function getString(PEnv: PJNIEnv; this: JObject; flag: JInt): JString; cdecl; begin   {your code....}   {Result:=;} end; { Class:     org_jmpessoa_app1_JNIHello   Method:    getSum   Signature: (II)I } function getSum(PEnv: PJNIEnv; this: JObject; x: JInt; y: JInt): JInt; cdecl; begin   {your code....}   {Result:=;} end; const NativeMethods:array[0..1] of JNINativeMethod = (    (name:'getString';     signature:'(I)Ljava/lang/String;';     fnPtr:@getString;),    (name:'getSum';     signature:'(II)I';     fnPtr:@getSum;) ); function RegisterNativeMethodsArray(PEnv: PJNIEnv; className: PChar; methods: PJNINativeMethod; countMethods:integer):integer; begin   Result:= JNI_FALSE;   curClass:= (PEnv^).FindClass(PEnv, className);   if curClass <> nil then   begin     if (PEnv^).RegisterNatives(PEnv, curClass, methods, countMethods) > 0 then Result:= JNI_TRUE;   end; end; function RegisterNativeMethods(PEnv: PJNIEnv): integer; begin   curClassPathName:= 'org/jmpessoa/app1/JNIHello';   Result:= RegisterNativeMethodsArray(PEnv, PChar(curClassPathName), @NativeMethods[0], Length(NativeMethods)); end; function JNI_OnLoad(VM: PJavaVM; reserved: pointer): JInt; cdecl; var   PEnv: PPointer {PJNIEnv}; begin   PEnv:= nil;   Result:= JNI_VERSION_1_6;   (VM^).GetEnv(VM, @PEnv, Result);   if PEnv <> nil then RegisterNativeMethods(PJNIEnv(PEnv));   curVM:= VM {PJavaVM};   curEnv:= PJNIEnv(PEnv); end; procedure JNI_OnUnload(VM: PJavaVM; reserved: pointer); cdecl; begin   if curEnv <> nil then (curEnv^).UnregisterNatives(curEnv, curClass);   curClass:= nil;   curEnv:= nil;   curVM:= nil;   Application.Terminate;   FreeAndNil(Application); end; exports   JNI_OnLoad name 'JNI_OnLoad',   JNI_OnUnload name 'JNI_OnUnload',   getString name 'Java_org_jmpessoa_app1_JNIHello_getString',   getSum name 'Java_org_jmpessoa_app1_JNIHello_getSum'; begin   Application:= TAndroidApplication.Create(nil);   Application.Title:= 'My Android Library';   Application.Initialize;   Application.CreateForm(TAndroidModule1, AndroidModule1); end. 2.4. follow the code hint: "save all files to location....." 2.5. From Lazarus IDE (laz4android1.1-41139)      Run -> Build III. BUILD AND RUN ANDROID APPLICATION      1.  From Eclipse IDE      1.1 right click your recent created project -> Run as -> Android Application IV.  GIT HUB      https://github.com/jmpessoa/lazandroidmodulewizard      To facilitate follows first code release on attachment (*.rar) and some interface pictures...      Have Fun! ---------------------------------------------------------------------- jmpessoa · 2013-09-11 15:27 Hi There, I made some improvements on parse (and bug fix  ). Now Java method signature like this: Code: [Select]public native int getGraphics(ByteBuffer graphicsBuffer, int w, int h);    Is handled correctly: Code: [Select]{ Class:     org_jmpessoa_pascalgraphics_GraphicsBoard   Method:    getGraphics   Signature: (Ljava/nio/ByteBuffer;II)I } function getGraphics(PEnv: PJNIEnv; this: JObject; graphicsBuffer: JObject; w: JInt; h: JInt): JInt; cdecl; begin end; Code: [Select]const NativeMethods:array[0..0] of JNINativeMethod = (    (name:'getGraphics';     signature:'(Ljava/nio/ByteBuffer;II)I';     fnPtr:@getGraphics;) ); Follows some example picture..... and the package (*.rar) Greetings! https://github.com/jmpessoa/lazandroidmodulewizard ---------------------------------------------------------------------- engkin · 2013-10-10 14:28 Thank you for sharing your code.    It did help me learn a few things like Lazarus project wizards and  Android ARM v7 needed compiler options. I had only one simple problem using it due to hard-coded path "C:\adt32\eclipse\workspace" in: uformandroidproject.pas (FormAndroidProject) --> ShellTreeView1 --> Root it worked after creating these folders and allowed my to change it to my actual folder  While working on your wizard did you have to re-build Lazarus every time you made a small change? or am I missing something?  Is it possible to use Build Modes to add compiler settings for both Arm v6 and v7 and maybe i386 to the same project using your project wizard? Thanks again. ---------------------------------------------------------------------- jmpessoa · 2013-10-10 15:09 Hi engkin, thank you! Actually when you modify a package you need re-install (this is a Lazarus question)... Hint: for install and re-intall package in Lazarus4Android close any cross-compile-android project and open a window project! Please get  more updated version from: https://github.com/jmpessoa/lazandroidmodulewizard I will fix the hard path today! Sorry, I have not learned about Build Modes... Greetings! ---------------------------------------------------------------------- picstart · 2013-10-10 16:04 With the risk of being shot as the messenger...this development is the the lifeboat for Lazarus. Android is a significant market and is growing. Future apps will be on handheld devices. Lazarus needs a robust path to Android. Many have given up already on Lazarus sure they could spend weeks trying to get Lazarus  to compile a single app but it is smarter to go another route. The originator of this smart approach admits the reason for this direction is that they realized the futility of the existing approach. This effort is trying to bring smart back and bury the obtuse solutions offered to date. Smart work! ---------------------------------------------------------------------- jmpessoa · 2013-10-10 18:26 Hi All, At the moment I am working hard to bring Android Controls for Lazarus  by simonsayz (http://forum.lazarus.freepascal.org/index.php/topic,22079.0.html) to talk with my Android Module Wizard.... follows some figures. Thanks to all! ---------------------------------------------------------------------- Leledumbo · 2013-10-13 22:06 QuoteAt the moment I am working hard to bring Android Controls for Lazarus  by simonsayzThat looks delicious, I'll be waiting... ---------------------------------------------------------------------- jmpessoa · 2013-11-17 14:32 Hi All, I can already anticipate some information about what we're talking about: very little code, just design ( without form design) ... that is: component model, LazAndroidWizard and  Object Inspector does the task.... The first part of my task is almost ready .... I hope to make available my code very soon! Follow some results just for curiosity ... happy Sunday day! *.lfm Code: [Select]object AndroidModule6: TAndroidModule6   OnCreate = DataModuleCreate   OldCreateOrder = False   BackButton = True   Title = 'jForm'   BackgroundColor = colbrBlack   OnCloseQuery = DataModuleCloseQuery   OnRotate = DataModuleRotate   OnJNIPrompt = DataModuleJNIPrompt   Height = 443   HorizontalOffset = 319   VerticalOffset = 145   Width = 224   object jTextView1: jTextView     Id = 26515     PosRelativeToAnchor = []     PosRelativeToParent = [rpCenterHorizontal]     LayoutParamWidth = lpWrapContent     LayoutParamHeight = lpWrapContent     MarginLeft = 10     MarginTop = 10     MarginRight = 10     MarginBottom = 10     Alignment = taLeft     Visible = True     Enabled = True     BackgroundColor = colbrDefault     FontColor = colbrYellow     FontSize = 0     Text = 'List View Demo'     left = 104     top = 24   end   object jTextView2: jTextView     Id = 36024     Anchor = jTextView1     PosRelativeToAnchor = [raBelow]     PosRelativeToParent = [rpLeft]     LayoutParamWidth = lpWrapContent     LayoutParamHeight = lpWrapContent     MarginLeft = 10     MarginTop = 10     MarginRight = 10     MarginBottom = 10     Alignment = taLeft     Visible = True     Enabled = True     BackgroundColor = colbrDefault     FontColor = colbrSilver     FontSize = 0     Text = 'Enter New Item:'     left = 48     top = 96   end   object jEditText1: jEditText     Id = 53166     Anchor = jTextView2     PosRelativeToAnchor = [raBelow]     PosRelativeToParent = [rpLeft]     LayoutParamWidth = lpTwoThirdOfParent     LayoutParamHeight = lpWrapContent     MarginLeft = 10     MarginTop = 10     MarginRight = 10     MarginBottom = 10     Alignment = taLeft     InputTypeEx = itxText     LineMaxLength = 360     Visible = True     BackgroundColor = colbrWhite     FontColor = colbrDefault     FontSize = 0     SingleLine = True     ScrollBarStyle = scrNone     MaxLines = 1     HorScrollBar = False     VerScrollBar = False     WrappingLine = True     left = 48     top = 152   end   object jButton1: jButton     Id = 0     Anchor = jEditText1     PosRelativeToAnchor = [raToRightOf, raAlignBaseline]     PosRelativeToParent = []     LayoutParamWidth = lpOneThirdOfParent     LayoutParamHeight = lpWrapContent     MarginLeft = 5     MarginTop = 5     MarginRight = 5     MarginBottom = 5     Visible = True     BackgroundColor = colbrDefault     Text = 'Add'     FontColor = colbrLightSteelBlue     FontSize = 0     OnClick = jButton1Click     left = 144     top = 152   end   object jEditText2: jEditText     Id = 80017     Anchor = jTextView3     PosRelativeToAnchor = [raBelow]     PosRelativeToParent = [rpLeft]     LayoutParamWidth = lpOneThirdOfParent     LayoutParamHeight = lpWrapContent     MarginLeft = 10     MarginTop = 10     MarginRight = 10     MarginBottom = 10     Alignment = taLeft     InputTypeEx = itxText     LineMaxLength = 360     Visible = True     BackgroundColor = colbrWhite     FontColor = colbrDefault     FontSize = 0     SingleLine = True     ScrollBarStyle = scrNone     MaxLines = 1     HorScrollBar = False     VerScrollBar = False     WrappingLine = True     left = 48     top = 320   end   object jTextView3: jTextView     Id = 5036     Anchor = jListView1     PosRelativeToAnchor = [raBelow]     PosRelativeToParent = [rpLeft]     LayoutParamWidth = lpWrapContent     LayoutParamHeight = lpWrapContent     MarginLeft = 10     MarginTop = 10     MarginRight = 10     MarginBottom = 10     Alignment = taLeft     Visible = True     Enabled = True     BackgroundColor = colbrDefault     FontColor = colbrSilver     FontSize = 0     Text = 'Enter Item Index:'     left = 48     top = 264   end   object jButton2: jButton     Id = 63804     Anchor = jEditText2     PosRelativeToAnchor = [raToRightOf, raAlignBaseline]     PosRelativeToParent = []     LayoutParamWidth = lpTwoThirdOfParent     LayoutParamHeight = lpWrapContent     MarginLeft = 5     MarginTop = 5     MarginRight = 5     MarginBottom = 5     Visible = True     BackgroundColor = colbrDefault     Text = 'Delete'     FontColor = colbrLightSteelBlue     FontSize = 0     OnClick = jButton2Click     left = 144     top = 320   end   object jListView1: jListView     Id = 8951     Anchor = jEditText1     PosRelativeToAnchor = [raBelow]     PosRelativeToParent = []     LayoutParamWidth = lpMatchParent     LayoutParamHeight = lpOneThirdOfParent     MarginLeft = 10     MarginTop = 0     MarginRight = 10     MarginBottom = 0     Items.Strings = (       'Lazarus'       'Pascal'       'Android'     )     Visible = True     BackgroundColor = colbrLightSteelBlue     FontColor = colbrRed     FontSize = 0     OnClickItem = jListView1ClickItem     left = 96     top = 208   end   object jButton3: jButton     Id = 0     Anchor = jEditText2     PosRelativeToAnchor = [raBelow]     PosRelativeToParent = []     LayoutParamWidth = lpMatchParent     LayoutParamHeight = lpWrapContent     MarginLeft = 5     MarginTop = 5     MarginRight = 5     MarginBottom = 5     Visible = True     BackgroundColor = colbrDefault     Text = 'ListView Items Clear '     FontColor = colbrLightSteelBlue     FontSize = 0     OnClick = jButton3Click     left = 96     top = 376   end end *.pas Code: [Select]{Hint: save all files to location: \jni } unit unit6;   {$mode objfpc}{$H+}   interface   uses   Classes, SysUtils, And_jni, And_jni_Bridge, Laz_And_Controls;   type   { TAndroidModule6 }   TAndroidModule6 = class(jForm)       jButton1: jButton;       jButton2: jButton;       jButton3: jButton;       jEditText1: jEditText;       jEditText2: jEditText;       jListView1: jListView;       jTextView1: jTextView;       jTextView2: jTextView;       jTextView3: jTextView;       procedure DataModuleCloseQuery(Sender: TObject; var CanClose: boolean);       procedure DataModuleCreate(Sender: TObject);       procedure DataModuleJNIPrompt(Sender: TObject);       procedure DataModuleRotate(Sender: TObject; rotate: integer;         var rstRotate: integer);       procedure jButton1Click(Sender: TObject);       procedure jButton2Click(Sender: TObject);       procedure jButton3Click(Sender: TObject);       procedure jListView1ClickItem(Sender: TObject; Item: Integer);     private       {private declarations}     public       {public declarations}   end;   var   AndroidModule6: TAndroidModule6; implementation   {$R *.lfm} { TAndroidModule6 } procedure TAndroidModule6.DataModuleCloseQuery(Sender: TObject;   var CanClose: boolean); begin    CanClose:= True; end;  //need here only to fix *.lfm parse fail on Lazarus4android... procedure TAndroidModule6.DataModuleCreate(Sender: TObject); begin   Self.BackgroundColor:= colbrBlack;   Self.OnJNIPrompt:= @DataModuleJNIPrompt;   Self.OnRotate:= @DataModuleRotate;   Self.OnCloseQuery:= @DataModuleCloseQuery; end; procedure TAndroidModule6.DataModuleJNIPrompt(Sender: TObject); begin   Self.Show; end; procedure TAndroidModule6.DataModuleRotate(Sender: TObject; rotate: integer; var rstRotate: integer); begin   Self.UpdateLayout; end; procedure TAndroidModule6.jButton1Click(Sender: TObject); begin   if jEditText1.Text <> '' then     jListView1.Items.Add(jEditText1.Text)   else     jListView1.Items.Add('item_'+ IntToStr(Random(100))); end; procedure TAndroidModule6.jButton2Click(Sender: TObject); begin    jListView1.Items.Delete(StrToInt(jEditText2.Text)); end; procedure TAndroidModule6.jButton3Click(Sender: TObject); begin   jListView1.Items.Clear; end; procedure TAndroidModule6.jListView1ClickItem(Sender: TObject; Item: Integer); begin   ShowMessage(IntToStr(Item)); end; end. ---------------------------------------------------------------------- Leledumbo · 2013-11-17 14:50 So it will look like a data module, no visual design? The layout must be done through code then, right? No problem actually, it's already a big step. The visual designer could wait ---------------------------------------------------------------------- jmpessoa · 2013-11-17 15:24 @Leledumbo:  QuoteThe layout must be done through code then, right? Yes, too. But basically I am using just the Object Inspector to configure the layout, in this sense no coding! Thank you! ---------------------------------------------------------------------- exdatis · 2013-11-17 15:27 Thank you very much for your effort. ---------------------------------------------------------------------- jmpessoa · 2013-11-17 15:34 And thanks too @simonsayz's  effort! ---------------------------------------------------------------------- engkin · 2013-11-17 19:24 The image you posted for your list view demo looks impressive!. I'm standing in the queue with other eager people that want to try it, patiently. ---------------------------------------------------------------------- jmpessoa · 2013-11-17 19:36 Hi engkin, Thanks for your interest .... I will need help for the next step: build the entire cycle of application without Eclipse! Greetings! ---------------------------------------------------------------------- engkin · 2013-11-17 19:53 I'm willing to help, assuming that I'm able to. ---------------------------------------------------------------------- Leledumbo · 2013-11-18 15:47 QuoteYes, too. But basically I am using just the Object Inspector to configure the layout, in this sense no coding!Hmm... does it use relative positioning or absolute or something else? ---------------------------------------------------------------------- jmpessoa · 2013-11-18 17:01 @Leledumbo QuoteHmm... does it use relative positioning or absolute or something else? Yes, relative e something else too! In my posted *.lfm, you can see: Code: [Select]object jEditText1: jEditText     Id = 53166     Anchor = jTextView2     PosRelativeToAnchor = [raBelow]     PosRelativeToParent = [rpLeft]     LayoutParamWidth = lpTwoThirdOfParent     LayoutParamHeight = lpWrapContent     MarginLeft = 10     MarginTop = 10     MarginRight = 10     MarginBottom = 10     ...............................................   end   object jButton1: jButton     Id = 0     Anchor = jEditText1     PosRelativeToAnchor = [raToRightOf, raAlignBaseline]     PosRelativeToParent = []     LayoutParamWidth = lpOneThirdOfParent     LayoutParamHeight = lpWrapContent     ..............................................   end  The main concept is "Anchor"  and the possibilities (at the moment...) are: Code: [Select] TPositionRelativeToAnchor = ( raAbove,                                   raBelow,                                   raToStartOf,                                   raToEndOf,                                   raToLeftOf,                                   raToRightOf,                                   raAlignBaseline,                                   raAlignTop,                                   raAlignBottom,                                   raAlignStart,                                   raAlignEnd,                                   raAlignLeft,                                   raAlignRight);   TPositionRelativeToParent = (rpBottom,                                rpTop,                                rpLeft,                                rpRight,                                rpStart,                                rpEnd,                                rpCenterHorizontal,                                rpCenterInParent,                                rpCenterVertical                                {rpTrue});   TLayoutParams = (lpMatchParent, lpWrapContent, lpHalfOfParent, lpOneQuarterOfParent,                    lpTwoThirdOfParent ,lpOneThirdOfParent, lpOneEighthOfParent,                    lpOneFifthOfParent, lpTwoFifthOfParent, lpThreeFifthOfParent, lpFourFifthOfParent,                    lp16px, lp24px, lp32px, lp40px, lp48px, lp72px, lp96px); and from *.pas you can see: Code: [Select]procedure TAndroidModule6.DataModuleRotate(Sender: TObject; rotate: integer;   var rstRotate: integer); begin   Self.UpdateLayout;   <<<----------------- suporte building in! end; Follow the attached a image after device direction change.... Thank you! ---------------------------------------------------------------------- Leledumbo · 2013-11-19 15:48 OK, that looks good. At least no need to worry the controls will be overlapping. ---------------------------------------------------------------------- TurboRascal · 2013-11-22 14:13 This seems great, and I guess a visual design could be added completely bypassing the Form Designer - the way reports are created for example. Clicking on a nonvisual component could open a small designer for placing and drawing controls, even a primitive one would be sufficient help for Android, I guess... ---------------------------------------------------------------------- jmpessoa · 2013-12-08 20:57 Hi All, I got another step in the layout management, especially the device orietation change challenge. Yes, the *NEW* jPanel simplifies and actually makes this task very easy and "smart". Follows code and image just for exemplification.... Achieved that goal I inclose the first part of my work and will try to available the new version of my LazAndroidWizard with support for  simonsayz's  Controls (including my own extensions.. Now I will focus on writing a more complete readme.txt/tutorial.... I want to complete this task as quickly as possible (03 days?) Thank to All and special thanks to Simonsayz! *.dfm Code: [Select]object AndroidModule1: TAndroidModule1   OnCreate = DataModuleCreate   OldCreateOrder = False   BackButton = True   Title = 'jForm'   BackgroundColor = colbrBlack   OnRotate = DataModuleRotate   OnJNIPrompt = DataModuleJNIPrompt   Height = 424   HorizontalOffset = 424   VerticalOffset = 125   Width = 265   object jPanel1: jPanel     Id = 139436     PosRelativeToAnchor = []     PosRelativeToParent = []     LayoutParamWidth = lpMatchParent     LayoutParamHeight = lpOneThirdOfParent     MarginLeft = 0     MarginTop = 0     MarginRight = 0     MarginBottom = 0     Visible = True     BackgroundColor = colbrLightSteelBlue     left = 64     top = 8   end   object jPanel2: jPanel     Id = 0     Anchor = jPanel1     PosRelativeToAnchor = [raBelow]     PosRelativeToParent = []     LayoutParamWidth = lpMatchParent     LayoutParamHeight = lpMatchParent     MarginLeft = 0     MarginTop = 0     MarginRight = 0     MarginBottom = 0     Visible = True     BackgroundColor = colbrWhite     left = 64     top = 304   end   object jTextView1: jTextView     Id = 3313746     PosRelativeToAnchor = []     PosRelativeToParent = [rpCenterHorizontal]     LayoutParamWidth = lpWrapContent     LayoutParamHeight = lpWrapContent     MarginLeft = 10     MarginTop = 10     MarginRight = 10     MarginBottom = 10     ParentPanel = jPanel1     Alignment = taLeft     Visible = True     Enabled = True     BackgroundColor = colbrDefault     FontColor = colbrRed     FontSize = 0     Text = 'jPanel Demo'     left = 136     top = 8   end   object jButton1: jButton     Id = 2882086     Anchor = jTextView1     PosRelativeToAnchor = [raBelow]     PosRelativeToParent = []     LayoutParamWidth = lpMatchParent     LayoutParamHeight = lpWrapContent     MarginLeft = 5     MarginTop = 5     MarginRight = 5     MarginBottom = 5     ParentPanel = jPanel1     Visible = True     BackgroundColor = colbrDefault     Text = 'Show Image Light'     FontColor = colbrDefault     FontSize = 0     OnClick = jButton1Click     left = 136     top = 72   end   object jImageView1: jImageView     Id = 0     Anchor = jTextView3     PosRelativeToAnchor = [raBelow]     PosRelativeToParent = []     LayoutParamWidth = lpMatchParent     LayoutParamHeight = lpMatchParent     MarginLeft = 0     MarginTop = 0     MarginRight = 0     MarginBottom = 0     ParentPanel = jPanel2     ImageIndex = 0     Images = jImageList1     Visible = True     BackgroundColor = colbrDefault     BackgroundImage = False     left = 120     top = 360   end   object jImageList1: jImageList     Images.Strings = (       'Lazarus_Logo_Light.png'       'Lazarus_Logo_Dark.png'     )     left = 192     top = 360   end   object jButton2: jButton     Id = 4091625     Anchor = jButton1     PosRelativeToAnchor = [raBelow]     PosRelativeToParent = []     LayoutParamWidth = lpMatchParent     LayoutParamHeight = lpWrapContent     MarginLeft = 5     MarginTop = 5     MarginRight = 5     MarginBottom = 5     ParentPanel = jPanel1     Visible = True     BackgroundColor = colbrDefault     Text = 'Show Image Dark'     FontColor = colbrDefault     FontSize = 0     OnClick = jButton2Click     left = 136     top = 134   end   object jTextView2: jTextView     Id = 0     PosRelativeToAnchor = []     PosRelativeToParent = [rpBottom, rpRight]     LayoutParamWidth = lpWrapContent     LayoutParamHeight = lpWrapContent     MarginLeft = 10     MarginTop = 10     MarginRight = 10     MarginBottom = 10     ParentPanel = jPanel1     Alignment = taLeft     Visible = True     Enabled = True     BackgroundColor = colbrDefault     FontColor = colbrMidnightBlue     FontSize = 0     Text = 'Panel 1'     left = 136     top = 192   end   object jTextView3: jTextView     Id = 9682626     PosRelativeToAnchor = []     PosRelativeToParent = [rpTop, rpLeft]     LayoutParamWidth = lpWrapContent     LayoutParamHeight = lpWrapContent     MarginLeft = 10     MarginTop = 10     MarginRight = 10     MarginBottom = 10     ParentPanel = jPanel2     Alignment = taLeft     Visible = True     Enabled = True     BackgroundColor = colbrDefault     FontColor = colbrSlateBlue     FontSize = 0     Text = 'Lazarus_Logo'     left = 120     top = 304   end   object jTextView4: jTextView     Id = 5428635     Anchor = jTextView3     PosRelativeToAnchor = [raAlignBaseline, raAlignRight]     PosRelativeToParent = [rpRight]     LayoutParamWidth = lpWrapContent     LayoutParamHeight = lpWrapContent     MarginLeft = 10     MarginTop = 10     MarginRight = 10     MarginBottom = 10     ParentPanel = jPanel2     Alignment = taLeft     Visible = True     Enabled = True     BackgroundColor = colbrDefault     FontColor = colbrMidnightBlue     FontSize = 0     Text = 'Panel 2'     left = 192     top = 304   end end *.pas Code: [Select]{Hint: save all files to location: C:\adt32\eclipse\workspace\AppDemo2\jni } unit unit1;   {$mode delphi}   interface   uses   Classes, SysUtils, And_jni, And_jni_Bridge, Laz_And_Controls;   type   { TAndroidModule1 }   TAndroidModule1 = class(jForm)       jButton1: jButton;       jButton2: jButton;       jImageList1: jImageList;       jImageView1: jImageView;       jPanel1: jPanel;       jPanel2: jPanel;       jTextView1: jTextView;       jTextView2: jTextView;       jTextView3: jTextView;       jTextView4: jTextView;       procedure DataModuleCreate(Sender: TObject);       procedure DataModuleJNIPrompt(Sender: TObject);       procedure DataModuleRotate(Sender: TObject; rotate: integer;         var rstRotate: integer);       procedure jButton1Click(Sender: TObject);       procedure jButton2Click(Sender: TObject);     private       {private declarations}     public       {public declarations}   end;   var   AndroidModule1: TAndroidModule1; implementation   {$R *.lfm}   { TAndroidModule1 } procedure TAndroidModule1.DataModuleCreate(Sender: TObject); begin   OnJNIPrompt:= DataModuleJNIPrompt;    {<-- delphi mode...}   OnRotate:= DataModuleRotate;          {<-- delphi mode...} end; procedure TAndroidModule1.DataModuleJNIPrompt(Sender: TObject); begin   jTextView3.Text:= jImageView1.ImageName;  //Lazarus_Logo_Light.png   Self.Show; end; procedure TAndroidModule1.jButton1Click(Sender: TObject); begin    jImageView1.ImageIndex:= 0;    jTextView3.Text:= jImageView1.ImageName;  //Lazarus_Logo_Light.png end; procedure TAndroidModule1.jButton2Click(Sender: TObject); begin     jImageView1.ImageIndex:= 1;     jTextView3.Text:= jImageView1.ImageName;  //Lazarus_Logo_Dark.png end; {rotate=1 --> device is on  vertical/default position; rotate=2 device is on horizontal position} procedure TAndroidModule1.DataModuleRotate(Sender: TObject; rotate: integer; var rstRotate: integer); begin    if rotate = 2 then   //after rotation device is on horizontal    begin       jPanel1.LayoutParamHeight:=lpMatchParent;       jPanel1.LayoutParamWidth:= lpHalfOfParent;       jPanel2.PosRelativeToAnchor:= [raToRightOf,raAlignBaseline];     end     else {1} //after rotation device is on vertical/default     begin       jPanel1.LayoutParamHeight:= lpOneThirdOfParent;       jPanel1.LayoutParamWidth:= lpMatchParent;       jPanel2.PosRelativeToAnchor:= [raBelow];     end;     Self.UpdateLayout; end; end. ---------------------------------------------------------------------- jmpessoa · 2013-12-14 05:20 Hi All, The Android Module Wizard version 0.2 that Introduces Android GUI Components - Based on Simonsayz's controls is on https://github.com/jmpessoa/lazandroidmodulewizard The Demos [Eclipse Projects] are here:     AppDemo1 - ref1. https://www.opendrive.com/files?Ml8zNjMwNTE0N18xVUZ2ag                  - A complete remake of Simonsayz's Demo          AppDemo2 - ref2. https://www.opendrive.com/files?Ml8zNjMwNTMxN19YTHgxWg              - Introduce jPanel e jCamara     :: Please, look for Lazarus project on \jni folder...     Yes, Lazarus does RAD for Android! Yes, the work is just beginning! Any assistance is very welcome! Thank to All and special thanks to Simonsayz! Here is the  complete "readme.txt" Quote Lazarus Android Module Wizard "A wizard for create JNI Android loadable module (.so) in Lazarus/Free Pascal using DataModules"       Author: Jose Marques Pessoa : jmpessoa__hotmail_com        https://github.com/jmpessoa/lazandroidmodulewizard             http://forum.lazarus.freepascal.org/index.php/topic,21919.0.html           Acknowledgements: Eny and Phil for the Project wizard hints...                  http://forum.lazarus.freepascal.org/index.php/topic,2 0763.msg120823.html#msg120823               Felipe for the Android support...               TrueTom for the Laz4Android Package (laz4android1.1-41139)                         https://skydrive.live.com/?cid=89ae6b50650182c6&id=89AE6B5065018 2C6%21149                            Simonsayz for the great work on Android [GUI] Controls                 http://forum.lazarus.freepascal.org/index.php/topic,22079.0.html              Lazarus forum community! version 0.2 - December 2013 -    :: NEW! Introduces Android GUI Components - Based on Simonsayz's controls [item IV]        :: revision 0.1 - 09 September - 2013 - Bugs fixs! version 0.1 - August 2013 -    [1] Warning: at the moment this code is just a *proof-of-concept*       I. INSTALL Laz4Android (https://skydrive.live.com/?cid=89ae6b50650182c 6&id=89AE6B50650182C6%21149)       warning: the original laz4android1.1-41139 is win32 and just for Android NDK-7c    1. From lazarus IDE - Install Wizard Packages       1.1 Package -> Open Package -> "tfpandroidbridge_pack.lpk"      Ref. image: https://www.opendrive.com/files?Ml8zNjMwNDQ3NF83SzhsZg       1.1.1 From Package Wizard             - Compile             - Use -> Install       1.2 Package -> Open Package -> "lazandroidwizardpack.lpk"         1.2.1 From Package Wizard             - Compile             - Use -> Install II. GENERIC USE 1. From Eclipse IDE - Create Android Project   1.1. File -> New -> Android Application Project ...[Next], [Next]...[Finish]!   1.2. From Package Explore -> src            :Right click your recent created package -> new -> class             :Enter new class name... (ex. JNIHello)          :Edit class code for wrapper native methods           ex:    public class JNIHello {       public native String getString(int flag);       public native int getSum(int x, int y);            static {       try {                System.loadLibrary("jnihello");  //*                   } catch(UnsatisfiedLinkError ule) {           ule.printStackTrace();       }            }         }      1.3. * warning: System.loadLibrary("...") must match class Name "lowercase"...        ex. JNIHello -> "jnihello"         2. From lazarus IDE (laz4android1.1-41139)    2.1. On "Create a new project" Dialog select:         ref. Image: https://www.opendrive.com/files?Ml8zNjMwMTY4MF9HMVRHRg    2.2. From "Android Module Wizard: Configure Paths"    Ref. Image: https://www.opendrive.com/files?Ml8zNjMwMTk0Nl9hNEtBUw      -Path to Eclipse Workspace          ex. C:\adt32\eclipse\workspace                -Path to Ndk Plataforms          ex. C:\adt32\ndk7\platforms\android-8\arch-arm\usr\lib      -Path to Ndk Toolchain             ex. C:\adt32\ndk7\toolchains\arm-linux- androideabi-4.4.3\prebuilt\windows\lib\gcc\arm-linux-androideabi\4.4.3          -Path to  Simonsayz's  code  templates (App.java + Controls.java):   //**        ex. C:\laz4android\components\LazAndroidWizard\java      -Select [Eclipse] Project Name:                                   //**    ex. C:\adt32\eclipse\workspace\AppDemo        ** needed only for Android Components Bridges...         2.3. OK    2.4. From "Android Module Wizard: Select Java Source for JNI..."       -Select the Java wrapper class for native methods....         ex. "JNIHello.java"    2.5. OK        - Pascal JNI Interface was created!    2.6. follow the code hint: "save all files to location....." {save all in \jni folder ...}        2.7. Implement the Pascal JNI Interface methods.....    2.8. From Lazarus_FOR_ANDROID IDE      Run -> Build         {.so was created! see \libs folders....}    2.9. Yes! You got it! III. BUILD and RUN ANDROID APPLICATION    1.  From Eclipse IDE         1.1.  double click your recent created project //that is: open project...    1.1.  right click your recent created project -> Refresh    1.2.  right click your recent created project -> Run as -> Android Application IV. SPECIAL GUIDE FOR ANDROID BRIDGES COMPONENTS USE   - NEW    1. From Eclipse IDE:         1.1. File -> New -> Android Application Project            1.2. [Next]    1.3. [Next]    1.4. [Next]    1.5. On "Create Activity" Dialog select:    [Next]                          ref. Image: https://www.opendrive.com/files?Ml8zNjMwMDUwOF9pZm4xMQ         1.6. On "Activity Name" Dialog enter: App  [Finish] //"App" name is mandatory!                              ref. Image: https://www.opendrive.com/files?Ml8zNjMwMDE0M19aZ2dkeA                   1.7  Right click your recent created project -> Close     2. From Lazarus IDE    2.1. Project -> New Project            2.2. On "Create a new project" Dialog select:         ref. Image: https://www.opendrive.com/files?Ml8zNjMwMTY4MF9HMVRHRg    2.3. From "Android Module Wizard: Configure Paths"       -Path to Eclipse Workspace           ex. C:\adt32\eclipse\workspace                      -Path to Ndk Plataforms                 ex. C:\adt32\ndk7\platforms\android-8\arch-arm\usr\lib            -Path to Ndk Toolchain                 ex. C:\adt32\ndk7\toolchains\arm-linux- androideabi-4.4.3\prebuilt\windows\lib\gcc\arm-linux-androideabi\4.4.3                -Path to  Simonsayz's  code  templates (App.java + Controls.java):                 ex. C:\laz4android\components\LazAndroidWizard\java            -Select [Eclipse] Project Name:                                               ex. C:\adt32\eclipse\workspace\AppDemo1            ref. Image: https://www.opendrive.com/files?Ml8zNjMwMTk0Nl9hNEtBUw          2.4. From "Android Module Wizard: Select Java Source for JNI..."       -From left panel/tree Select src-> ...-> "your recent created project"                 -From top panel/View right click "App.java" file       -On Popup menu select/click                       ref. Image: https://www.opendrive.com/files?Ml8zNjMwMjI1Ml9kOXNRag                 -Double Click "Control.java" file...           ref. Image: https://www.opendrive.com/files?Ml8zNjMwMjkyM183ZVd2MA    2.5. OK           - Pascal JNI Interface was created!    2.6. follow the code hint: "save all files to location....."  { \jni folder }    2.7. From Component Palete select page          ref. Image: https://www.opendrive.com/files?Ml8zNjMwNDQ3NF83SzhsZg                                   -Put e configure some component on DataModule form... etc...    2.8. From Lazarus IDE       -Run -> Build              2.9.  From Eclipse IDE           -Double click recent created project     {Open project ...}           -Right click your recent created project -> Refresh                   -Right click your recent created project -> Run as -> Android Application         V. Yes! Lazarus/Free Pascal does RAD on Android! VI. Download Demos [Eclipse Projects]     AppDemo1 - ref1. https://www.opendrive.com/files?Ml8zNjMwNTE0N18xVUZ2ag     AppDemo2 - ref2. https://www.opendrive.com/files?Ml8zNjMwNTMxN19YTHgxWg VII. Ref. Lazarus forum: http://forum.lazarus.freepascal.org/index.php/topic,21919.0.html      -Help and Hints      -Bugs      -Sugestions      -Colaborations         -Critics      -Roadmap      -etc.. VIII. The work is just beginning! ---------------------------------------------------------------------- Leledumbo · 2013-12-14 06:45 Thank you, jmpessoa. I'm on my way to the github page You should put the demo in the github as well IMO, better in its own folder and let everybody adds their own Hmm... it seems that Eclipse (workspace) is required to create any project with this. I think it could be removed and we could provide standard Android project structure that only requires ant to build, as simonsayz libraries do. ---------------------------------------------------------------------- jmpessoa · 2013-12-14 15:17 @Leledumbo, Yes, the Eclipse dependency needs to be removed! I will try learn about  this part of the problem, I will study @simonsayz solution and @delphifreak solution.... Yes, I put the AppDemos on github now... Thank you very much for your interest! ---------------------------------------------------------------------- Sergionn · 2013-12-14 15:59 Also thank you, Jmpessoa for your work!!!!!!!!! Eclipse dependency not the right way, it should be done like in Simon's work. By the way - maybe someones knows - what happends with Simon, why he does't continue his work? ---------------------------------------------------------------------- Leledumbo · 2013-12-14 16:15 Hmm... I got linker errors due to either .lpk requiring NDK libraries to link with the IDE but it's not stated anywhere in the readme. ---------------------------------------------------------------------- jmpessoa · 2013-12-14 16:45 @Leledumbo: I put this on readme.txt: Code: [Select]  warning: the original laz4android1.1-41139 is win32 and just for Android NDK-7c but I do not know if I understood your question ... @Sergionn: Yes, Simon help is very important, I tried some communication with him but had no success... Thank you. ---------------------------------------------------------------------- Leledumbo · 2013-12-14 17:22 QuoteI put this on readme.txt: Code: [Select]   warning: the original laz4android1.1-41139 is win32 and just for Android NDK-7c but I do not know if I understood your question ...Upon installing, I got these: Quote/usr/bin/ld: cannot find -lGLESv2 /usr/bin/ld: cannot find -lGLESv1_CM /usr/bin/ld: cannot find -ljnigraphics /usr/bin/ld: cannot find -llog I do know they're part of NDK, it's easy to find them. But any of the .lpk doesn't contain path to these libs (-Fl) and the readme contains no instruction for this. ---------------------------------------------------------------------- jmpessoa · 2013-12-14 17:43 @Leledumbo, 1. You is using Windows or Linux? 2. Please check my "Android Module Wizard: Configure Paths"     ref Image:     https://www.opendrive.com/files?Ml8zNjMwMTk0Nl9hNEtBUw 3. Yes, they're part of NDK,  the interfaces are:     Laz_And_GLESv1_Canvas_h.pas     Laz_And_GLESv2_Canvas_h.pas     And_bitmap_h.pas     And_log_h.pas I'm trying to understand your question. Thank you. ---------------------------------------------------------------------- Leledumbo · 2013-12-14 17:54 QuoteYou is using Windows or Linux? Linux QuotePlease check my "Android Module Wizard: Configure Paths" I haven't gone that far, the problem appears when installing the .lpk to the IDE ---------------------------------------------------------------------- jmpessoa · 2013-12-14 18:31 @Leledumbo, Linux? I haven't gone that far too...    1. At the moment "lazandroidwizardpack.lpk" has a simple Windows dependency the '/'  separator! I will fix this! (Edit: Directory Separator was Fix! ) 2. The  "tfpandroidbridge_pack.lpk" I don't remember, I will see. (Edit: No problem found!) What *.lpk  is you trying? Thanks. ---------------------------------------------------------------------- jmpessoa · 2013-12-14 18:57 Hi, I Add new infos in Readme.txt, About Package, Components and LCL  and NDK libs(.so) dependency on laz4android1.1-41139 IDE cross compiler... 1. Package creation: just LCLBase is permitted! not "LCL"!      - You will nedd  LCLBase Required Package for register procedure.    - yes, other No GUI stuff is permitted. 2. Component creation       2.1. If you will use custom icon then you will need two files: the first to compoment(s) code         and the second for Register procedure code.         example:     2.1.1. File 1 - "foo.pas" - component code - here no LCL dependency at all! Code: [Select] unit foo; {$mode objfpc}{$H+} interface uses Classes, SysUtils; type TFoo = class(TComponent)   private { Private declarations } protected { Protected declarations } public { Public declarations } published { Published declarations } end; implementation   end.           2.1.2. File 2 - "regtfoo.pas" - register code -  here you will need LCLBase for LResources unit Code: [Select]        unit regtfoo; {$mode objfpc}{$H+} interface uses   Classes, SysUtils, LResources{ here is the LCLBase dependency!}; Procedure Register; implementation Procedure Register; begin   {$I tfoo_icon.lrs}  //you custom icon   RegisterComponents('Android Bridges',[TFoo); end; initialization end.  3. NDK libs (.so) dependency on laz4android1.1-41139 IDE cross compiler     3.1.  You will need two files: the first to NDK *.so lib interface and the second for you component/unit code.    Example:    3.1.1. File 1 - "And_log_h.pas" the header interface file  Code: [Select] unit And_log_h; {$mode delphi} interface const libname='liblog.so';   ANDROID_LOG_UNKNOWN=0;       ANDROID_LOG_DEFAULT=1;       ANDROID_LOG_VERBOSE=2;       ANDROID_LOG_DEBUG=3;       ANDROID_LOG_INFO=4;       ANDROID_LOG_WARN=5;       ANDROID_LOG_ERROR=6;       ANDROID_LOG_FATAL=7;       ANDROID_LOG_SILENT=8; type   android_LogPriority=integer;   function __android_log_write(prio:longint; tag,text: pchar):longint; cdecl; external libname name '__android_log_write';   function LOGI(prio:longint;tag,text:pchar):longint; cdecl; varargs; external libname name '__android_log_print'; implementation end.       3.1.2. File 2 - "And_log.pas" component/unit code Code: [Select] unit And_log; interface uses    And_log_h;  // <-- here is the link to NDK lib procedure log(msg: pchar); implementation procedure log(msg: pchar); begin           __android_log_write(ANDROID_LOG_FATAL,'crap',msg); end; end. Thank you. ---------------------------------------------------------------------- Leledumbo · 2013-12-15 04:03 QuoteLinux? I haven't gone that far too...    I don't think this should be locked to certain platform, if it could work on Windows, it should work on any other supported OS. Quote1. At the moment "lazandroidwizardpack.lpk" has a simple Windows dependency the '/'  separator! I will fix this! (Edit: Directory Separator was Fix! )Simple, isn't it? The cross platform constants are in the System unit Quote2. The  "tfpandroidbridge_pack.lpk" I don't remember, I will see. (Edit: No problem found!) What *.lpk  is you trying?Both. lazandroidmodulewizard has implicit dependencies on jnigraphics in androidwizard_intf due to its dependency on Android_jni_bridge via Laz_And_Controls unit. While tfpandroidbridge has dependencies on all of those .so (GLESv2, GLESv1_CM, jnigraphics, log). ---------------------------------------------------------------------- jmpessoa · 2013-12-15 04:30 @Leledumbo Yes, I have this problem too on windows and laz4android1.1-41139 cross compile... my solution was that I wrote in my post  up   Code: [Select]About Package, Components and LCL  and NDK libs(.so) dependency on laz4android1.1-41139 IDE cross compiler... And with this strategies it was resolved on windows! But I learned something else ... before installing a package I close my cross compile project and open a "dummy" windows project.... And so things are working... but on linux it seems that the behavior is another ... Thank you ---------------------------------------------------------------------- Leledumbo · 2013-12-15 05:20 I'm going to check what laz4android does so that the IDE can link to those .so EDIT: it doesn't seem to have anything to do with laz4android, so it's purely tfpandroidbridge problem. On Windows, shared library doesn't have to exist upon linking. While on *nix, it's a must. I need to find a workaround for this. ---------------------------------------------------------------------- zariq · 2013-12-15 15:54 Hi. Copied appdemo1 onto phone, looks nice. Must have taken a lot of work, jni is very laborious. Just a few of minor points. I couldn't get the back key to work from the main (menu) form.  I had to press the home key, which leaves it paused in the background or kill it from task manager. Pressing the return key in edittext inserts a line but also hides the keynoard. That should only happen if it's a "done" or "go". Just incase you forget imageview needs scaletype implementing. FIT_XY distorts the image if the imageview is larger but wrong scale. Thanks. ---------------------------------------------------------------------- jmpessoa · 2013-12-15 15:56 @Leledumbo, Yes, After many experimentations, I  found a workaround for Windows just as posted up: QuoteAbout Package, Components and LCL  and NDK libs(.so) dependency on laz4android1.1-41139 IDE cross compiler... Thank you. ---------------------------------------------------------------------- jmpessoa · 2013-12-15 16:12 @zariq, Thank you for the experimentation... Yes, and our work is just beginning ... I am learning yet!  surely every collaboration is welcome! JNI is hard and our task is build a RAD environment for android too, Lazarus is about it! About: QuoteI couldn't get the back key to work from the main (menu) form. I will try a solution. Best regards. ---------------------------------------------------------------------- jmpessoa · 2013-12-16 22:41 Hi All, Yes, Ant support almost ready! I got: 1. Compile/Build ---> I got the Apk! 2. Install in Emulator 3. Uninstall from Emulator But when I run App from Emulator I got: QuoteE/AndroidRuntime(  913):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) E/AndroidRuntime(  913):        at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime(  913): Caused by: java.lang.NoClassDefFoundError: Controls E/AndroidRuntime(  913):        at java.lang.Runtime.nativeLoad(Native Method) E/AndroidRuntime(  913):        at java.lang.Runtime.loadLibrary(Runtime.java:369) E/AndroidRuntime(  913):        at java.lang.System.loadLibrary(System.java:535) E/AndroidRuntime(  913):        at lazarus.org.appantdemo1.Controls.(Controls.java:3948) E/AndroidRuntime(  913):        ... 15 more E/AndroidRuntime(  913): Caused by: java.lang.ClassNotFoundException: Didn't find class "Controls" on path: /data/app/lazarus.org.appantdemo1-1.apk E/AndroidRuntime(  913):        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65) E/AndroidRuntime(  913):        at java.lang.ClassLoader.loadClass(ClassLoader.java:501) E/AndroidRuntime(  913):        at java.lang.ClassLoader.loadClass(ClassLoader.java:461) E/AndroidRuntime(  913):        ... 19 more My build.xml is simply: Code: [Select]             Something was forgotten to bind  my native "libcontrols.so" on Apk? Thank You. Edit: I found this: Quote  It turns out that this was a bug in the Android SDK. The release notes of r18 say:   "Fixed Ant issues where some jar libraries in the libs/ folder are not picked up in some cases."   Since updating from r17 to r19 fixed the problem for me, this was very likely the cause of the problem. Ref. http://stackoverflow.com/questions/9944698/why-is-the-android- support-library-not-added-to-my-apk I will update my SDK r17 for r19 too, and try again! Edit2: While I wait for my SDK update, I ran: aapt.exe list AppAntDemo1-debug.apk, and for my surprise: Quoteres/layout/activity_app.xml AndroidManifest.xml resources.arsc res/drawable-hdpi/ic_launcher.png res/drawable-ldpi/ic_launcher.png res/drawable-mdpi/ic_launcher.png res/drawable-xhdpi/ic_launcher.png res/drawable-xxhdpi/ic_launcher.png classes.dex lib/armeabi/libcontrols.so    <<----------- yes ! META-INF/MANIFEST.MF META-INF/CERT.SF META-INF/CERT.RSA My libcontrols.ao is there! Then, what is incorrect  in my apk? ---------------------------------------------------------------------- zariq · 2013-12-18 01:36 Didn't find class "Controls" In the version I downloaded you had controls with a small c. ---------------------------------------------------------------------- jmpessoa · 2013-12-18 03:21 @Zarik, thank you for replay. I have a file  "Controls.java" and a class "Controls": Code: [Select]//------------------------------------------------------ ------------------------ //Javas/Pascal Interface Class //-------------------------------------------------------------------- ---------- //!!!! classcontrols  // public  class Controls { // public   Activity       activity;            // Activity public   RelativeLayout appLayout;           // Base Layout public   int            screenStyle = 0;     // Screen Style [Dev:0 , Portrait: 1, Landscape : 2] // Jave -> Pascal Function ( Pascal Side = Event ) public  native int  pAppOnScreenStyle(); public  native void pAppOnCreate     (Context context,RelativeLayout layout); public  native void pAppOnNewIntent  (); public  native void pAppOnDestroy    (); public  native void pAppOnPause      (); public  native void pAppOnRestart    (); public  native void pAppOnResume     (); public  native void pAppOnActive     (); public  native void pAppOnStop       (); public  native void pAppOnBackPressed(); public  native int  pAppOnRotate     (int rotate); public  native void pAppOnConfigurationChanged(); public  native void pAppOnActivityResult(int requestCode, int resultCode, Intent data); // public  native void pOnClick     (int pasobj, int value); public  native void pOnChange    (int pasobj, int EventType); public  native void pOnEnter     (int pasobj); public  native void pOnTimer     (int pasobj); // public  native void pOnDraw      (int pasobj, Canvas canvas); public  native void pOnTouch     (int pasobj, int act, int cnt,float x1, float y1,float x2, float y2); public  native void pOnGLRenderer(int pasobj, int EventType, int w, int h); // public  native void pOnClose     (int actform); // public  native int  pOnWebViewStatus (int pasobj, int EventType, String url); public  native void pOnAsyncEvent    (int pasobj, int EventType, int progress); // Load Pascal Library static {     Log.i("JNI_Java", "1.load libcontrols.so");     System.loadLibrary("controls");     Log.i("JNI_Java", "2.load libcontrols.so");     } Yes, there is a small "control" in System.loadLibrary("controls")..... And more, in my /bin/classes I got the compiled  "Controls.class"! ---------------------------------------------------------------------- jmpessoa · 2013-12-19 18:49 Yes,  after a complete cleanup in my Android SDK, the problem was solved! The support for Ant project is on the way! Thanks to All. ---------------------------------------------------------------------- Leledumbo · 2013-12-20 06:31 I'm still struggling to make the package installable on Linux. It's kinda weird actually since, for example, the And_Bitmap_h functions called links to libjnigraphics.so which is part of the TARGET (Android), the HOST (Linux) shouldn't need it. Even if it should, which libjnigraphics.so should the IDE link to? x86? arm? Neither is right, since the .so is not meant for the HOST. ---------------------------------------------------------------------- jmpessoa · 2013-12-22 07:12 Hi All, Android Module Wizard Ver. 0.3 -  Introduces Support to Ant Project! Now you can manage the entire cycle of application development just using Lazarus  and native tools:  jdk, ant, sdk and ndk. You can get here:          http://wwww.github.com/jmpessoa For a complete description, please, read the updated "readme.txt" Attached below the new entry form for project and paths configuration... Thank to all! ---------------------------------------------------------------------- Sergionn · 2013-12-22 07:36 Jmpessoa, yor are good for strugging for pascal's future by doing this. Thank you! But give you you little advice: 1) Simplify all STEPS to do to archive the result, it should be like this:  a) install packadge  b) load project  c) build it  - thats it, until this it will be more easy to make android apps in andoid studio or eclipse or whatever  and even to study java not such commplicated quest compared by following all instructions in readme file of your project........  and please remove eclipse projects and any dependency about it for simpify ---------------------------------------------------------------------- jmpessoa · 2013-12-22 14:42 @Sergionn, thaks for your advice: I will, split "readme.txt": one for Eclipse users and other for Ant users.... I hope  so things will be less complicated... the fact is that there is still a java background in development (Simon's "Control.java" + "App.java") and so support the eclipse help much ... Thank you! ---------------------------------------------------------------------- jmpessoa · 2013-12-22 18:55 Ok, Thanks to @Sergionn, Now there are two fast tutorials: one for Ant users and other for Eclipse users. From " fast_tutorial_ant_users.txt":                    ref. http://www.github.com/jmpessoa Quote **Tutorial: Lazarus Android Module Wizard for "Ant" users ** "A wizard for create JNI Android loadable module (.so) in Lazarus/Free Pascal using DataModules"       Author: Jose Marques Pessoa : jmpessoa__hotmail_com           Please, for complete reference read "readme.txt" I. INSTALL Laz4Android (https://skydrive.live.com/?cid=89ae6b50650182c 6&id=89AE6B50650182C6%21149)         warning: the original laz4android1.1-41139 is win32 and just for Android NDK-7c       HINT: To install/reinstall a package open a "dummy" windows project.... you always MUST close the cross compile project!      1. From Laz4Android IDE (laz4android1.1-41139)  - Install Wizard Packages       1.1 Package -> Open Package -> "tfpandroidbridge_pack.lpk"      Ref. image: https://www.opendrive.com/files?Ml8zNjMwNDQ3NF83SzhsZg       1.1.1 From Package Wizard             - Compile             - Use -> Install       1.2 Package -> Open Package -> "lazandroidwizardpack.lpk"         1.2.1 From Package Wizard             - Compile             - Use -> Install II. [GUI Support] Android Components Bridges - NEW! Simon's Controls remake with many extensions!                 1. From Lazarus IDE    1.1. Project -> New Project            1.2. On "Create a new project" Dialog select:         ref. Image: https://www.opendrive.com/files?Ml8zNjMwMTY4MF9HMVRHRg                 1.3. From "Android Module Wizard: Configure Paths"              ref. Image: https://www.opendrive.com/files?Ml8zNjg3MDU0MV9nTXZsdA                                     -Path to Ndk Plataforms              ex. C:\adt32\ndk7\platforms\android-8\arch-arm\usr\lib             -Path to Ndk Toolchain                       ex. C:\adt32\ndk7\toolchains\arm-linux- androideabi-4.4.3\prebuilt\windows\lib\gcc\arm-linux-androideabi\4.4.3                 -Path to  Simonsayz's  code  templates (App.java + Controls.java):                   ex. C:\laz4android\components\LazAndroidWizard\java             -Path to Workspace              ex. C:\adt32\Ant\workspace             -Ant Project Name:       Ant Preface Package Name:                                                       ex. AppAntDemo1            ex. org.jmpessoa  -warning: then final package name will be:            "org.jmpessoa.appantdemo1"                                               -Select other Options [Instructions; FPU; Project; GUI Controls; Target Api]         1.4. OK!                                 1.5. From "Android Module Wizard: Select Java Source for JNI..."       -From left panel/tree Select "your recent created project" -> src                 -From top panel/View right click "App.java" file       -On Popup menu select/click                       ref. Image: https://www.opendrive.com/files?Ml8zNjMwMjI1Ml9kOXNRag                 -Double Click "Control.java" file...           ref. Image: https://www.opendrive.com/files?Ml8zNjMwMjkyM183ZVd2MA    1.6. OK           - Pascal JNI Interface was created!    1.7. follow the hint on code: "save all files to location....."  { \jni folder }    1.8. From Component Palette select page                     ref. Image: https://www.opendrive.com/files?Ml8zNjMwNDQ3NF83SzhsZg                                   -Put e configure some component on DataModule form... etc...    1.9. From Lazarus IDE       -Run -> Build         2.0. Read the "readme.txt" in your project folder to buidl Android Application [Apk]                         III. Yes! Lazarus/Free Pascal does RAD on Android! IV. Download Demos     [Eclipse Projects]       AppDemo1 - ref1. https://www.opendrive.com/files?Ml8zNjMwNTE0N18xVUZ2ag        AppDemo2 - ref2. https://www.opendrive.com/files?Ml8zNjMwNTMxN19YTHgxWg     [Ant Projects]             AppAntDemo1 - ref3. https://www.opendrive.com/files?Ml8zNjk2NDU4NF94ck5Fdw Thank you!     _____jmpessoa_hotmail_com_____ Thank to All. ---------------------------------------------------------------------- jmpessoa · 2013-12-28 22:00 Hi, I have updated "Lazarus Android Module Wizard" : ver. 0.3 - rev. 0.1     ref. http://www.github.com/jmpessoa some news: - Introduces Support for multi build modes [ArmV6, ArmV7a, x86]; -Introduce Support for new TrueTom Laz4Android :: win32/NDK-9/{ARM and x86 !}        ref. https://sourceforge.net/projects/laz4android/files/?source=navbar - Introduce Support for NoGUI Ant Project; -some improvements in the files:                "readme.txt",                "fast_tutorial_eclipse_users.txt" and                 "fast_tutorial_ant_users.txt" -New No GUI Demo Projects. Follows attached the new (simpler) GUI interface for Path/Project Configurations. Thanks for all ! Happy 2014 !! ---------------------------------------------------------------------- Sergionn · 2013-12-29 08:06 Thanks again for your work! And happy new 2014 year too! Also can you share your investigations in using freetype2 lib on android? http://forum.lazarus.freepascal.org/index.php?topic=21923.0 ---------------------------------------------------------------------- Leledumbo · 2013-12-29 16:21 I've managed to make the package linked on linux, using some dirty hacks: Build all libraries in the attachmentPut it somewhere ldconfig can find (or just run ldconfig with their directories as arguments)Do a little modification in Laz_And_GLESv1_Canvas_h and Laz_And_GLESv2_Canvas_h by using ifdef for desktop platforms (details below)Required changes: Code: [Select]// in Laz_And_GLESv1_Canvas_h libname = {$ifdef android}'libGLESv1_CM.so'{$else}'libGL.so'{$endif}; // in Laz_And_GLESv2_Canvas_h libname = {$ifdef android}'libGLESv2.so'{$else}'libGL.so'{$endif}; The only missing OpenGL function is glFustrumf, which I add in the dummy libjnigraphics. The idea of this is just to make the package installable in the IDE, applications will still use the android version of the libraries. UPDATE: Ant demo project works beautifully on my MI2S Just a suggestion: no need to rar any of the demo projects, let them as is for easy update. Compressing will only make update tracking difficult. UPDATE #2: Eclipse demo projects easily converted to Ant project, just need to copy build.xml in the AppAntDemo1. I found some bugs with these demos, such as not being able to exit app by pressing back, but that's just a little bug which I think could easily be fixed. ---------------------------------------------------------------------- jmpessoa · 2013-12-29 16:40 @Leledumbo, Congratulation! I think this is very important because this approach can be applied in others portings (mac ?)... Thank You! EDITED 1:   I can apply like: Code: [Select]  libname = {$ifdef android}'libGLESv1_CM.so'                  {$else ifdef linux}'libGL.so'{$endif};    this will work ? EDITED 2: the changes was applied! Quote     New! Support for Linux! Thanks to Leledumbo! Quote     by Leledumbo for Linux users:               1. Build all libraries in the  ../LazAndroidWizard/linux/dummylibs               2. Put it somewhere ldconfig can find (or just run ldconfig with their directories as arguments)                 "The idea of this is just to make the package installable in the [Lazarus for Linux] IDE,                   applications will still use the android version of the libraries."                 ref. http://forum.lazarus.freepascal.org/index.php/topic ,21919.msg137216/topicseen.html EDITED 3: well,  I  applied something more conservative: Code: [Select]  libname = {$ifdef linux}'libGL.so'{$else}'libGLESv1_CM.so' ok? ---------------------------------------------------------------------- jmpessoa · 2013-12-29 22:13 Hi all, I make a important fix to AndroidManifest produce... in "uformandroidproject.pas" This bug was  introduced after some minor fix... I'm sorry! ref.  http://www.github.com/jmpessoa Thank to all! ---------------------------------------------------------------------- Leledumbo · 2013-12-30 03:09 Quotelibname = {$ifdef linux}'libGL.so'{$else}'libGLESv1_CM.so'This should be OK, since it's really intended for Linux system only. However, if you want to support other OSes, this name must be adjusted for each. Have you tested it yourself anyway? ---------------------------------------------------------------------- jmpessoa · 2013-12-30 14:51 @Leledumbo, QuoteHave you tested it yourself anyway? Yes, I do. That is Ok for Windows...  yes, a more flexible solution is need (what about mac?).  But, I  know the  "{$ifdef}" syntax  very very little... ---------------------------------------------------------------------- zariq · 2013-12-30 15:45 From the latest downloads, clicking ok after choosing jni android module from the new project dialog results in a Class "TGroupBox" not found messagebox. ---------------------------------------------------------------------- jmpessoa · 2013-12-30 16:06 Thank you Zarik! Sorry, this bug was  introduced after some minor change... Fixed! ---------------------------------------------------------------------- Leledumbo · 2013-12-30 17:08 QuoteYes, I do. That is Ok for Windows...I mean, on Linux. Maybe I miss something in my explanation, I need to make sure that it works on someone else's machine, not just mine. ---------------------------------------------------------------------- zariq · 2013-12-30 19:06 Quote from: jmpessoa on December 30, 2013, 05:06:27 pm Sorry, this bug was  introduced after some minor change... Fixed! Thank you. ---------------------------------------------------------------------- zariq · 2013-12-30 21:48 I've managed to create a project and it's running on a device. I can put buttons and other stuff and works ok. In the onclick for a button I did a showmessage and assigned some text to a textview, unfortunately both actions result in a crash. The error is: 12-30 21:41:00.280: E/dalvikvm(4791): JNI ERROR (app bug): accessed stale local reference 0x1ea00025 (index 9 in a table of size 7) 12-30 21:41:00.280: E/dalvikvm(4791): VM aborting 12-30 21:41:00.280: A/libc(4791): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 4791 (com.example.app). Thanks. ---------------------------------------------------------------------- jmpessoa · 2013-12-30 22:08 Hi zarik, Please, put you "unit1.pas" and "*.lfm" here.... I wil try help. Thank you. ---------------------------------------------------------------------- zariq · 2013-12-30 22:22 Code: [Select]{Hint: save all files to location: C:\Users\mustafa\workspace\App\jni } unit unit1;   {$mode delphi}   interface   uses   Classes, SysUtils, And_jni, And_jni_Bridge, Laz_And_Controls;   type   { TAndroidModule1 }   TAndroidModule1 = class(jForm)       jButton1: jButton;       jButton2: jButton;       jTextView1: jTextView;       procedure DataModuleCreate(Sender: TObject);       procedure DataModuleJNIPrompt(Sender: TObject);       procedure DataModuleRotate(Sender: TObject; rotate: integer;         var rstRotate: integer);       procedure jButton1Click(Sender: TObject);     private       {private declarations}     public       {public declarations}   end;   var   AndroidModule1: TAndroidModule1; implementation   {$R *.lfm} { TAndroidModule1 } procedure TAndroidModule1.DataModuleCreate(Sender: TObject); begin        //jus to fix *.lfm parse fail on Laz4Android cross compile...     Self.OnJNIPrompt:= DataModuleJNIPrompt; end; procedure TAndroidModule1.DataModuleJNIPrompt(Sender: TObject); begin     Self.Show; end; procedure TAndroidModule1.DataModuleRotate(Sender: TObject; rotate: integer;   var rstRotate: integer); begin    Self.UpdateLayout; end; procedure TAndroidModule1.jButton1Click(Sender: TObject); begin    ShowMessage('message');    jTextView1.Text:='text'; end; end. I just checked those two statements in button1click, but probably would be same for anything jni. thanks for looking. Code: [Select]object AndroidModule1: TAndroidModule1   OnCreate = DataModuleCreate   OldCreateOrder = False   BackButton = True   Title = 'jForm'   BackgroundColor = colbrBlack   OnRotate = DataModuleRotate   OnJNIPrompt = DataModuleJNIPrompt   Height = 343   HorizontalOffset = 292   VerticalOffset = 164   Width = 313   object jButton1: jButton     Id = 2238642     PosRelativeToAnchor = [raAlignLeft]     PosRelativeToParent = []     LayoutParamWidth = lpHalfOfParent     LayoutParamHeight = lpWrapContent     MarginLeft = 5     MarginTop = 5     MarginRight = 5     MarginBottom = 5     Visible = True     BackgroundColor = colbrDefault     Text = 'button1'     FontColor = colbrDefault     FontSize = 0     OnClick = jButton1Click     left = 100     top = 61   end   object jButton2: jButton     Id = 0     Anchor = jButton1     PosRelativeToAnchor = [raToRightOf, raAlignBaseline]     PosRelativeToParent = []     LayoutParamWidth = lpHalfOfParent     LayoutParamHeight = lpWrapContent     MarginLeft = 5     MarginTop = 5     MarginRight = 5     MarginBottom = 5     Visible = True     BackgroundColor = colbrDefault     Text = 'button2'     FontColor = colbrDefault     FontSize = 0     left = 123     top = 221   end   object jTextView1: jTextView     Id = 0     Anchor = jButton1     PosRelativeToAnchor = [raBelow]     PosRelativeToParent = []     LayoutParamWidth = lpWrapContent     LayoutParamHeight = lpWrapContent     MarginLeft = 10     MarginTop = 10     MarginRight = 10     MarginBottom = 10     Alignment = taLeft     Visible = True     Enabled = True     BackgroundColor = colbrDefault     FontColor = colbrSilver     FontSize = 0     Text = 'jTextView'     left = 78     top = 299   end end ---------------------------------------------------------------------- jmpessoa · 2013-12-30 23:16 @zariq,  try  this change: Old: Code: [Select] object jButton1: jButton     Id = 2238642     PosRelativeToAnchor = [raAlignLeft]     <<<----------- New: Code: [Select] object jButton1: jButton     Id = 2238642     PosRelativeToAnchor = []     <<<-----------  That is,  jButton1 do not have a anchor.... only parent. EDIT 1: Yes, I got: " 12-30 23:53:47.100: E/dalvikvm(3693): JNI ERROR (app bug): accessed stale local reference 0xbb100025 (index 9 in a table of size 7) 12-30 23:53:47.100: W/dalvikvm(3693): JNI WARNING: jclass is an invalid local reference (0xbb100025) 12-30 23:53:47.110: W/dalvikvm(3693):              in Lcom/example/appdemotrybug/Controls;.pOnClick:(II)V (GetMethodID) " I'm trying to see what happened .... please, wait. EDIT 2: Yes, just some SDK/NDK/Laz4Android incompatibility! Please, change AndroidManifest.xml you have something like this: Code: [Select] Change simply to: Code: [Select] Please, make this change in your template too:   ...\LazAndroidWizard\java\AndroidManifest.txt Thank you very much! Fixed on GitHub. ---------------------------------------------------------------------- zariq · 2013-12-31 01:57 My lfm got  got corrupted so deleted project. Having trouble getting it to run this time round. Had different names for application and activity wouldn't work, renaming  application to same as activity solved it, but because of conflicts due to renaming have to create it again. Will let you know when I get it going. By the way should I download the new version or try it with the current one. thanks. ---------------------------------------------------------------------- jmpessoa · 2013-12-31 02:09 @zariq, Ok. What project model you is trying? Ant or Eclipse? Thank you. ---------------------------------------------------------------------- zariq · 2013-12-31 02:11 Eclipse. ---------------------------------------------------------------------- jmpessoa · 2013-12-31 02:21 Ok. When you are creating your app the Project name can be any.... only the MainActivity needs to be nomead "App". Thank you. ---------------------------------------------------------------------- zariq · 2013-12-31 02:24 Making the change in manifest works for showmessage. Thank you very much. ---------------------------------------------------------------------- zariq · 2013-12-31 02:31 Ok, it might have been paths or something. ---------------------------------------------------------------------- jmpessoa · 2014-01-02 05:53 Hi, @zariq, The problem is in using API > 13 (ex. android:minSdkVersion = 14),  I think that is related to: http://android-developers.blogspot.cz/2011/11/jni-local-reference- changes-in-ics.html I'm trying to find a solution! Thank you! EDIT: I update GitHub for a more conservative approach: the max for "android:minSdkVersion" on AndroidManifest.xml now is "13"... Meanwhile, I am seeking for a "true" solution...... EDIT#2: Good News! the bug was solved! more details later .... ---------------------------------------------------------------------- Leledumbo · 2014-01-26 11:34 Hi, jmpessoa. Could you name the wizard form variables (buttons, checkgroups, radios, etc) meaningfully? I would like to change the forms to comply with LCL autosize/layout. The forms may look good on Windows, but on other platforms, they're messy. Also some things for improvement: Don't use -o in Others tab, use Target file name in Paths instead. And make it to be ../libs/armeabi/libcontrols.so by default.Don't use -FU in Others, use Unit output directory in Paths instead. And make it to be lib by default (it would be a single target project anyway)-FLlibdl.so doesn't seem to be required anymore in recent FPC ---------------------------------------------------------------------- jmpessoa · 2014-01-26 14:05 Hi Leledumbo, Thanks for your suggestions ... I'll see if I can make these changes ... in fact I'm still working (a lot!) to overcome the BUG when API > 13.  This is related here: http://android-developers.blogspot.cz/2011/11/jni-local-reference- changes-in-ics.html I needed to re-engineer all the code ... but I think it is now almost done. Thank you! ---------------------------------------------------------------------- Leledumbo · 2014-02-05 14:35 The back on last (main) formseems to be buggy. The application does exit, but actually it crashes. I can only get these two backtrace lines: Code: [Select]I/DEBUG   (  182):     #00  pc 000ad874  /data/data/com.marsoft.piutangman/lib/libcontrols.so (LAZ_AND_CONTROLS_$$_JAVA_EVENT_PAPPONBACKPRESSED$PJNIENV$POINTER+72) I/DEBUG   (  182):     #01  pc 00023b6c  /data/data/com.marsoft.piutangman/lib/libcontrols.so (P$CONTROLS_$$_PAPPONBACKPRESSED$PJNIENV$POINTER+40)Looking at the code: Code: [Select]AForm := App.Forms.Stack[App.Forms.Index-1].Form;I'm curious with App.Forms.Index, so I add: Code: [Select]if App.Forms.Index <= 0 then App.Forms.Index := 1;before that line, and the app doesn't crash but it can't exit as well. So I guess the value is either 0 or less. That makes App.Forms.Index at least -1, while App.Forms.Stack index starts from 0, that's the point where the crash occurs. I've tried remote debugging but it doesn't seem to work well. GDB says libcontrols.so is missing debugging information, I've tried both stabs and dwarf, neither works. ---------------------------------------------------------------------- jmpessoa · 2014-02-05 14:45 @ Leledumbo, You are correct .... I also found this problem (and others ...), please wait, I'll try to provide a more stable version later this week with support for api > 13 ..... Thank you! ---------------------------------------------------------------------- jmpessoa · 2014-02-09 00:00 Hi All,      I updated Android Module Wizard.      version 0.4:: NEW! Add Support for Android API > 13.               A lot of code lines was fix/changed/Added!       Fix BackButton issue. Now all Forms close correctly.      Please, see "readme.txt"  and "AppDemo1"  for others changes.      ref:  http://github.com/jmpessoa/lazandroidmodulewizard      @Leledumbo: Now I will try your suggestions...      Thanks to everyone! ---------------------------------------------------------------------- Leledumbo · 2014-02-09 02:36 Git.Pull(); Do you have any tutorial to use the And_jni(_bridge?) to create wrapper for arbitrary Android API? I need to access sqlite, my app would be highly database driven. EDIT: Found a bug in the Ant demo App.java on line 5, the line should be commented. ---------------------------------------------------------------------- jmpessoa · 2014-02-09 14:15 @ Leledumbo,     Ok, I will write a "How To". About: QuoteFound a bug in the Ant demo App.java on line 5, the line should be commented. Please, which is the "text" of that line? Thank you! EDIT: Ok. A carriage return appeared out of nowhere in my commented line! Thank you! ---------------------------------------------------------------------- Leledumbo · 2014-02-09 14:52 QuotePlease, which is the "text" of that line?[and Lazarus by jmpessoa@hotmail.com - december 2013] <- it's not commented I found another bug, the Ant demo is enough as a test app. Open the app first, then exit by pressing back button. Then try to open the app again. You'll get blank form instead. Another bug in GetPathToJNIFolder, it will return relative path because the first slash (root) will be trimmed as well. I change the routine body to: Code: [Select]  i := Pos('src',fullPath);   if i > 2 then begin     Result := Copy(fullPath,1,i - 2); // we don't need the trailing slash   end else     raise Exception.Create('src folder not found');because that's what the routine is looking for from my analysis. ---------------------------------------------------------------------- jmpessoa · 2014-02-09 15:21 @Leledumbo, Please, put the fixed GetPathToJNIFolder here.... I will fix my code for linux Compatibility. Thank you! ---------------------------------------------------------------------- Leledumbo · 2014-02-09 15:58 The code is above, it's full body of the method. ---------------------------------------------------------------------- jmpessoa · 2014-02-09 19:16 @Leledumbo, QuoteOpen the app first, then exit by pressing back button. Then try to open the app again. You'll get blank form instead Please, try this in ["Controls.java", line 4468] for all GUI Apps Demos.... Code: [Select]       public  void appFinish () {             activity.finish();            System.exit(0);   // << ----------- Fix Here!        } Thank you. ---------------------------------------------------------------------- Leledumbo · 2014-02-15 11:13 QuotePlease, try this in ["Controls.java", line 4468] for all GUI Apps Demos....OK, that works. Thanks. Suggestion: Open tfpandroidbridge_pack.lpk->Package Options->Usage->Add paths to dependent packages/projects->Library, then add linux/dummylibs. This will make installation easier on Linux but shouldn't hurt on Windows (but please test, I don't have windows). Anyway, since these libraries are not meant to be used in actual program, I think it's OK to provide a precompiled version of them in the same directory. Or otherwise, provide additional instruction in the readme / fast tutorial to compile these libs before installing the .lpk. Another question: how can I create a list view with custom content? I want to create something like: Code: [Select] ... With the ability to add/remove the row anytime. Last but not least: your demo .apk could run on at least 2.2, while the one I built myself requires at least 4.0. Setting minsdkversion to 10 doesn't seem to work. ---------------------------------------------------------------------- jmpessoa · 2014-02-15 16:47 @Leledumbo, I'm still here: QuoteI need to access sqlite, my app would be highly database driven. Yes, the support to Sqlite is almost ready! I think I can still provide it this weekend. And then I will use it to write a "how to"... Thank you! ---------------------------------------------------------------------- jmpessoa · 2014-02-16 18:47 Hi,    I have made available a new update to Android Module Wizard.    ref:  http://github.com/jmpessoa/lazandroidmodulewizard    New!     Added [Partial] Support to SQLite:      .New components: jSqliteDataAccess, jSqliteCursor.    .Supported FIELD_TYPE at the moment::  INTEGER, STRING, FLOAT         .New Eclipse project demo:  AppSqliteDemo1 Thank you! ---------------------------------------------------------------------- Leledumbo · 2014-02-17 17:05 Alright, that's a nice start. I think that's enough for my requirement. Anyway, have you consulted with the developers about .lfm parsing problem? I think it's appropriate to discuss in FPC mailing list, since {$R support comes from the compiler. As an experiment, you might want to test .lrs resources to see whether the problem also appears there. If you're OK, please give me write access so I can push my local commits (github account name is the same as here: leledumbo). I'm still waiting for the custom row on listview ---------------------------------------------------------------------- jmpessoa · 2014-02-18 22:39 @Leledumbo, QuoteIf you're OK, please give me write access so I can push my local commits... Yes, OK!  you have write access! Thank you! EDIT:  Update!!  Image/BLOB Support to SQLite is ready!!! ---------------------------------------------------------------------- jmpessoa · 2014-02-23 04:34 @Leledumbo, Code: [Select]  I want to create something like: Code: [Select] ... Quote   With the ability to add/remove the row anytime. Ok.  Please, see the picture [attachment] .... What about? ---------------------------------------------------------------------- Leledumbo · 2014-02-23 04:44 Nice! I hope it's not a component by itself, creating the custom row by code is OK for me, as long as I can mix widgets freely. ---------------------------------------------------------------------- jmpessoa · 2014-02-23 04:59 Well, as my first attempt I created some new properties to component jListView: hasWigets {CheckBox or RadioButton or Button...} and too  hasImage.... But, that is just a first attempt.... maybe I can create something more flexible like a property/component "jCustomRow"....  I will try! Thank you. ---------------------------------------------------------------------- Leledumbo · 2014-02-23 10:04 QuoteBut, that is just a first attempt.... maybe I can create something more flexible like a property/component "jCustomRow"....  One approach: jListView can have a property called CustomRow of type "class of jCustomRow". The user may extend the class with other widgets and assign required callbacks. Another approach: jListView can have a property called CustomRow, containing a list of widget. I have no idea whether object inspector already supports such a mixed values, so this idea might be less visible than above approach. ---------------------------------------------------------------------- jmpessoa · 2014-02-26 00:21 @Leledumbo Please, clarify his [listview] row requirement. As it should hypothetically be shown? if possible, use real information... Thank you! ---------------------------------------------------------------------- Leledumbo · 2014-02-26 05:01 I want to build a row containing name and checkbox (as a sign that this row is included in the selections) and a textview (for inputting value). I'm creating an application to manage debts and claims, this list will contain the people involved in an event that introduces the debts and claims. ---------------------------------------------------------------------- jmpessoa · 2014-02-27 01:05 Ok, Now we can get something like shown in picture [Attachment], where the rows can be individually modified: image, text, text color, font size, widget [check or radio or button or textview] etc.... and two events can be  handled: list_item click an widget click. Thank you! ---------------------------------------------------------------------- Leledumbo · 2014-02-27 08:51 Thanks, has it been pushed to github? ---------------------------------------------------------------------- jmpessoa · 2014-03-01 22:08 Hi, I have pushed update version to github! ref.  https://github.com/jmpessoa/lazandroidmodulewizard Now, we can get something like shown in picture [Attachment]. Thank you! ---------------------------------------------------------------------- Leledumbo · 2014-03-02 04:09 Git.Pull(); thanks ---------------------------------------------------------------------- Leledumbo · 2014-03-02 16:54 Could you please try this: Press the checkboxPress the item, the checkbox gets unchecked ---------------------------------------------------------------------- jmpessoa · 2014-03-02 17:41 I got correct! See my picture [Attachment].  Well, I am using just emulator. I will continue testing! Thank you. Edit 1: OK, I got this error: "E/AndroidRuntime(1100): java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.widget.CheckBox"... Just when image is clicked! I will fix this just now!  [BUG FIX !!] Edit 2: I Will fix/synchronize java side items list and pascal side items list for Add, Clear, Delete... etc... [FIX !!] Edit 3:  I can modify the OnClickItem signature: (Sender: TObject; Item: Integer); To: (Sender: TObject; Item: Integer; itemText: string); And OnClickWidgetItem signature: (Sender: TObject; Item: integer; checked: boolean); To: OnClickWidgetItem(Sender: TObject; Item: integer; itemText: string; checked: boolean); What about? EDIT 4: [FIX EDIT_1 and EDIT_2].             . Added New Method GetText(index: integer) to jListView.             .updated AppDemo1...             . GITHUB was updated!           Thank you! ---------------------------------------------------------------------- Fatih KILIÇ · 2014-03-21 08:37 Hi, dear android developers. Project is very good and i'm interesting it. I'm waiting to implement TINIFile or TRegistry classes. Thanks, good works. ---------------------------------------------------------------------- Leledumbo · 2014-03-21 09:42 QuoteProject is very good and i'm interesting it. I'm waiting to implement TINIFile or TRegistry classes.Not related to this project, those classes should work provided you give the correct android permissions. ---------------------------------------------------------------------- Fatih KILIÇ · 2014-03-21 10:06 Thank Leledumbo. I solved my code mistake. Code: [Select]procedure TAndroidModule1.jButton1Click(Sender: TObject); var   INIFile: TINIFile;   Val: string; begin   INIFile := TINIFile.Create('/sdcard/data.ini');   //INIFile.WriteString('100', '101', 'trial');   Val := INIFile.ReadString('100', '101', 'error');   jEditText1.Text := Val; end; ---------------------------------------------------------------------- Fatih KILIÇ · 2014-03-21 10:56 I have another question: Have you got a work of Menu object? I need this object for my project. ---------------------------------------------------------------------- jmpessoa · 2014-03-22 23:00 Hi @Fatih, Thank you for your interest and enthusiasm and the TINIFile use example. In fact I'm working on a major improvement in Android Module Wizard which will facilitate the implementation of new components. The idea is that you will enter with the java [wrapper] class and receive the pascal component code including the jni_bridge part. Ok. I'll try to implement Menu object. Thank you! ---------------------------------------------------------------------- Fatih KILIÇ · 2014-03-23 07:34 Thanks jmpessoa for you reply. In my opinion is very excellent work. Thanks to evaluation my request. Good works. ---------------------------------------------------------------------- Sergionn · 2014-03-23 19:33 Quote from: jmpessoa on March 23, 2014, 12:00:09 amThe idea is that you will enter with the java [wrapper] class and receive the pascal component code including the jni_bridge part.That's great idea! can't wait when you will publish some results! Then we shall be able to android development with more big steps into! And thank you for your work again! It's very important especially because of firemonkey fiasco . Don't let object pascal to be gone! ---------------------------------------------------------------------- Fatih KILIÇ · 2014-03-27 11:45 Hi jmpessoa, Can you add a new property to jEditText, BorderStyle = [bsNone, bsSingle] or similar border property? Thanks. ---------------------------------------------------------------------- jmpessoa · 2014-04-06 18:18 Quote ....can't wait when you will publish some results! Yes, My work is almost done ... but now I need a little help from Linux and Mac users:  can someone send me [jmpessoa_at_hotmail_com] a executable version of "lazres" [lazarus/tools] ? thanks in advance! ---------------------------------------------------------------------- Stephano · 2014-04-13 22:14 Great work! I am on Linux, and don't use Laz4Android, but have built Lazarus and fpc accordingly from source. 1- Libraries issue: I made a quick workaround. Ex: Code: [Select]{$IFDEF android}   // jnigraphics   function AndroidBitmap_getInfo(env: PJNIEnv; jbitmap: jobject; info: PAndroidBitmapInfo): cint;                                      cdecl; external libjnigraphics name 'AndroidBitmap_getInfo';  function AndroidBitmap_lockPixels(env: PJNIEnv; jbitmap: jobject; addrPtr: PPointer {void**}): cint;                                      cdecl; external libjnigraphics name 'AndroidBitmap_lockPixels';   function AndroidBitmap_unlockPixels(env: PJNIEnv; jbitmap: jobject): cint;                                      cdecl; external libjnigraphics name 'AndroidBitmap_unlockPixels'; {$ELSE}   function AndroidBitmap_getInfo(env: PJNIEnv; jbitmap: jobject; info: PAndroidBitmapInfo): cint;  function AndroidBitmap_lockPixels(env: PJNIEnv; jbitmap: jobject; addrPtr: PPointer {void**}): cint;   function AndroidBitmap_unlockPixels(env: PJNIEnv; jbitmap: jobject): cint; {$ENDIF} implementation {$IFnDEF android} function AndroidBitmap_getInfo(env: PJNIEnv; jbitmap: jobject;   info: PAndroidBitmapInfo): cint; begin   Result := 0; end; function AndroidBitmap_lockPixels(env: PJNIEnv; jbitmap: jobject;   addrPtr: PPointer): cint; begin   Result := 0; end; function AndroidBitmap_unlockPixels(env: PJNIEnv; jbitmap: jobject): cint; begin   Result := 0; end; {$ENDIF} Another solution would be to use explicit loading of the libraries. 2- Java resources: What are these? I downloaded Simonsay's package. What next? 3- New project wizard: if something is missing (like ant workspace),  I get an error message, but I have to repeat the whole procedure. 4- New project wizard: For ndk ver9, there is no API level 17 which I use. 5- Why do you still use Lazarus resources instead of fpc resources? I have other comments, but I'll keep them for later. If you still need lazres for Linux, let me know and I'll email it to you. ---------------------------------------------------------------------- jmpessoa · 2014-04-14 02:00 @Stephano, 1. Thanks for your interest! 2. About workaround on Linux:  please, look for    @leledumbo advices in some previous posts and in folder  .../LazAndroidWizard/linux   ("please_readme.txt"), and more generally look for "readme.txt "IV. Technical Notes:..." 3.  Java resources: What are these? Please, just point/configure to the folder   ..../LazAndroidWizard/java      (My modified version of simonsay's work is there! ) 4. About ant workspace... just a base folder/reference for you [folder] project code. Like Eclipse Workspace... The others questions: I will try some fix... Thank you! Ps. Yes, please, send me the Linux executable "lazres". I need it to produce component Icon resource. ---------------------------------------------------------------------- Stephano · 2014-04-14 08:40 I saw Leledumbo's post and the readme file. The 2 solutions that I proposed are much cleaner and don't require any extra steps from the user. I was able to make a working app, but I found more issues: 1- Don't add any options in 'other options'. Instead use the 'Paths' for -Fl -FU -o 2- Remove from other options -Xd -FL -Cf -P -dANDROID. -FL is not needed (at least Leledumbo and I don't need it), and the other options should be placed in fpc.cfg. This is debatable in order to accommodate everybody's needs. 3- The batch files are Windows only. I can help you with Linux scripts. 4- If the project name has capital letters (MyProject1), then strange errors occur. Note: I sent you an email with the resources utilities ---------------------------------------------------------------------- jmpessoa · 2014-04-14 13:06 @Stephano, About 1 and 2: Yes, so my priority queue  allow, I will  improve it! About 3. Yes, You can help me! Please, send me the Linux scripts which mimics these *.bat! About 4. Very strange indeed! I'll do some testing here... note: yes, I received. Thank You! note: Please, send me the modified  *.pas with IFDEFs workaround! ---------------------------------------------------------------------- Fatih KILIÇ · 2014-04-26 10:34 Hi. When I call from main module the java function (from Controls.java), application crashes. What is problem? Code: [Select]procedure TfrmMain.btnClick(Sender: TObject);   var   s: string; begin   s := jSysInfo_PathDat(app.Jni.jEnv, app.Jni.jThis, App.Jni.jThis);   // or   s := jSysInfo_PathDat(gapp.Jni.jEnv, gapp.Jni.jThis, gapp.Jni.jThis);   // or   s := getPathDataBase(app.Jni.jEnv, app.Jni.jThis, App.Jni.jThis);   ShowMessage(s);   Exit; end; ---------------------------------------------------------------------- jmpessoa · 2014-04-26 13:19 Hi Fatih, Please, try my new:  function GetFilePath(filePath: TFilePath): string; Where: TFilePath = (fpathNone, fpathApp, fpathData, fpathExt, fpathDCIM, fpathDataBase); Example:   ShowMessage(GetFilePath(fpathApp));   ShowMessage(GetFilePath(fpathData));   ShowMessage(GetFilePath(fpathExt));   ShowMessage(GetFilePath(fpathDCIM));   ShowMessage(GetFilePath(fpathDataBase));  Thank you! ---------------------------------------------------------------------- Fatih KILIÇ · 2014-04-27 07:04 Hi jmpessoa. First thanks for you reply. But my main problem is, when i "direct call" jSysInfo_PathApp, jSysInfo_PathDat, jSysInfo_PathDataBase, jSysInfo_PathExt, jSysInfo_PathDCIM (in the And_jni_Bridge.pas file) functions from my main module, the application is crashes. I want to write my code and improve And_jni_Bridge functions. Generally context variables (in Controls.java) causing to crash. Any idea for this problem. ---------------------------------------------------------------------- jmpessoa · 2014-04-27 16:04 Hi Fatih, This is a more complicated question concerning the android API >13, so I had to rewrite a lot of code in original Simon's  "Controls.java" to overcome this difficulty .... To a better understanding of the problem, please, read some previous post when I raised this issue .... Thank you. EDIT 1: Refs.:       http://forum.lazarus.freepascal.org/index.php/topic,21919.60.html       http://android-developers.blogspot.cz/2011/11/jni-local- reference-changes-in-ics.html ---------------------------------------------------------------------- Stephano · 2014-04-27 19:52 I know we can use the Lazarus/Android jButton, but as an exercise, I want to create manually an android control using JNI and display it on the form. Example: MyClass := ...FindClass('Landroid/widget/button') ConstructorID := ...GetMethodID(...) MyButton := ...NewObject(...) How can the button be placed on the form? ---------------------------------------------------------------------- jmpessoa · 2014-05-03 23:34 Hi All, I finally got a major update for Lazarus Android Wizard. It Now offers two new aid/assistance to increase the productivity of coding. 1.You can now produce a almost complete pascal JNI component code from a java wrapper class! 2.You can now get assistance for produce the java warapper class! A proof of concept: New Components [Android Bridges Extra] and Demos [Eclipse Projects]:       jMyHello    [AppTryCode1]       jMediaPlayer    [AppTryCode2]       jTextFileManager,                 jDumpJavaMethods [AppTryCode3] //given a request and suggestion of @Stephano Please, read the new "fast_tutorial_jni_bridges_component_create.txt" for more info! ref: https://github.com/jmpessoa/lazandroidmodulewizard Thanks for all! For a first impression,  given a java wrapper class "jMyHello" Code: [Select]class jMyHello /*extends ...*/ {                private long     pascalObj = 0;      // Pascal Object         private Controls controls  = null;   // Control Class for events         private Context  context   = null;         private int    mFlag;          // <<----- custom property         private String mMsgHello = ""; // <<----- custom property         private int[]  mBufArray;      // <<----- custom property         public jMyHello(Controls _ctrls, long _Self, int _flag, String _hello) { //Add more '_xxx' params if needed!           //super(_ctrls.activity);           context   = _ctrls.activity;           pascalObj = _Self;           controls  = _ctrls;           mFlag = _flag;           mMsgHello = _hello;           mBufArray = null;           Log.i("jMyHello", "Create!");                  }         public void jFree() {           //free local objects...            mBufArray = null;         }        //write others [public] methods code here......  <<----- customs methods         public void SetFlag(int _flag) {             mFlag =  _flag;          }         public int GetFlag() {            return mFlag;          }         public void SetHello(String _hello) {         mMsgHello =  _hello;          }         public String GetHello() {            return mMsgHello;          }                 public String[] GetStringArray() {         String[] strArray = {"Helo", "Pascal", "World"};             return strArray;          }                         public String[] ToUpperStringArray(String[] _msgArray) {         int size = _msgArray.length;         String[] resStr = new String[size];         for (int i = 0; i < size; i++) {         resStr[i]= _msgArray[i].toUpperCase();         }             return resStr;          }               public String[] ConcatStringArray(String[]  _strArrayA, String[]  _strArrayB) {                 int size1 = _strArrayA.length;         int size2 = _strArrayB.length;                 String[] resStr = new String[size1+size2];                 for (int i = 0; i < size1; i++) {           resStr[i]= _strArrayA[i];         }                 int j = size1;         for (int i = 0; i < size2; i++) {           resStr[j]= _strArrayB[i];           j++;         }                     return resStr;         }                 public int[] GetIntArray() {         int[] mIntArray = {1, 2, 3};             return mIntArray;         }         public int[] GetSumIntArray(int[] _vA, int[] _vB, int _size) {            mBufArray = new int[_size];            for (int i=0; i < _size; i++) {               mBufArray[i] = _vA[i] + _vB[i];            }            return mBufArray;         }                         public void ShowHello() {            Toast.makeText(controls.activity, mMsgHello, Toast.LENGTH_SHORT).show();                }        } Just a click and We can get: Code: [Select]unit myhello; {$mode delphi} interface uses   Classes, SysUtils, And_jni, And_jni_Bridge, Laz_And_Controls; type {Draft Component code by "Lazarus Android Module Wizard" [5/3/2014 20:33:27]} {https://github.com/jmpessoa/lazandroidmodulewizard} {jControl template} jMyHello = class(jControl)  private     Fflag: integer; Fhello: string;  protected  public     constructor Create(AOwner: TComponent); override;     destructor  Destroy; override;     procedure Init; override;     function jCreate( _flag: integer; _hello: string): jObject;     procedure jFree();     procedure SetFlag(_flag: integer);     function GetFlag(): integer;     procedure SetHello(_hello: string);     function GetHello(): string;     function GetStringArray(): TDynArrayOfString;     function ToUpperStringArray(var _msgArray: TDynArrayOfString): TDynArrayOfString;     function ConcatStringArray(var _strArrayA: TDynArrayOfString; var _strArrayB: TDynArrayOfString): TDynArrayOfString;     function GetIntArray(): TDynArrayOfInteger;     function GetSumIntArray(var _vA: TDynArrayOfInteger; var _vB: TDynArrayOfInteger; _size: integer): TDynArrayOfInteger;     procedure ShowHello();  published end; function jMyHello_jCreate(env: PJNIEnv; this: JObject;_Self: int64; _flag: integer; _hello: string): jObject; procedure jMyHello_jFree(env: PJNIEnv; this: JObject; _jmyhello: JObject); procedure jMyHello_SetFlag(env: PJNIEnv; this: JObject; _jmyhello: JObject; _flag: integer); function jMyHello_GetFlag(env: PJNIEnv; this: JObject; _jmyhello: JObject): integer; procedure jMyHello_SetHello(env: PJNIEnv; this: JObject; _jmyhello: JObject; _hello: string); function jMyHello_GetHello(env: PJNIEnv; this: JObject; _jmyhello: JObject): string; function jMyHello_GetStringArray(env: PJNIEnv; this: JObject; _jmyhello: JObject): TDynArrayOfString; function jMyHello_ToUpperStringArray(env: PJNIEnv; this: JObject; _jmyhello: JObject; var _msgArray: TDynArrayOfString): TDynArrayOfString; function jMyHello_ConcatStringArray(env: PJNIEnv; this: JObject; _jmyhello: JObject; var _strArrayA: TDynArrayOfString; var _strArrayB: TDynArrayOfString): TDynArrayOfString; function jMyHello_GetIntArray(env: PJNIEnv; this: JObject; _jmyhello: JObject): TDynArrayOfInteger; function jMyHello_GetSumIntArray(env: PJNIEnv; this: JObject; _jmyhello: JObject; var _vA: TDynArrayOfInteger; var _vB: TDynArrayOfInteger; _size: integer): TDynArrayOfInteger; procedure jMyHello_ShowHello(env: PJNIEnv; this: JObject; _jmyhello: JObject); implementation   {---------  jMyHello  --------------} constructor jMyHello.Create(AOwner: TComponent); begin   inherited Create(AOwner);   //your code here.... end; destructor jMyHello.Destroy; begin   if not (csDesigning in ComponentState) then   begin     if jForm(Owner).App <> nil then     begin       if jForm(Owner).App.Initialized then       begin         if FjObject <> nil then         begin            jFree();            FjObject:= nil;         end;       end;     end;   end;   //you others free code here...'   inherited Destroy; end; procedure jMyHello.Init; begin   if FInitialized  then Exit;   inherited Init;   //your code here: set/initialize create params....   FjObject:= jCreate(Fflag ,Fhello);   FInitialized:= True; end;   function jMyHello.jCreate( _flag: integer; _hello: string): jObject; begin    Result:= jMyHello_jCreate(jForm(Owner).App.Jni.jEnv, jForm(Owner).App.Jni.jThis , int64(Self) ,_flag ,_hello); end; procedure jMyHello.jFree(); begin   //in designing component state: set value here...   if FInitialized then      jMyHello_jFree(jForm(Owner).App.Jni.jEnv, jForm(Owner).App.Jni.jThis, FjObject); end; procedure jMyHello.SetFlag(_flag: integer); begin   //in designing component state: set value here...   if FInitialized then      jMyHello_SetFlag(jForm(Owner).App.Jni.jEnv, jForm(Owner).App.Jni.jThis, FjObject, _flag); end; function jMyHello.GetFlag(): integer; begin   //in designing component state: result value here...   if FInitialized then    Result:= jMyHello_GetFlag(jForm(Owner).App.Jni.jEnv, jForm(Owner).App.Jni.jThis, FjObject); end; procedure jMyHello.SetHello(_hello: string); begin   //in designing component state: set value here...   if FInitialized then      jMyHello_SetHello(jForm(Owner).App.Jni.jEnv, jForm(Owner).App.Jni.jThis, FjObject, _hello); end; function jMyHello.GetHello(): string; begin   //in designing component state: result value here...   if FInitialized then    Result:= jMyHello_GetHello(jForm(Owner).App.Jni.jEnv, jForm(Owner).App.Jni.jThis, FjObject); end; function jMyHello.GetStringArray(): TDynArrayOfString; begin   //in designing component state: result value here...   if FInitialized then    Result:= jMyHello_GetStringArray(jForm(Owner).App.Jni.jEnv, jForm(Owner).App.Jni.jThis, FjObject); end; function jMyHello.ToUpperStringArray(var _msgArray: TDynArrayOfString): TDynArrayOfString; begin   //in designing component state: result value here...   if FInitialized then    Result:= jMyHello_ToUpperStringArray(jForm(Owner).App.Jni.jEnv, jForm(Owner).App.Jni.jThis, FjObject, _msgArray); end; function jMyHello.ConcatStringArray(var _strArrayA: TDynArrayOfString; var _strArrayB: TDynArrayOfString): TDynArrayOfString; begin   //in designing component state: result value here...   if FInitialized then    Result:= jMyHello_ConcatStringArray(jForm(Owner).App.Jni.jEnv, jForm(Owner).App.Jni.jThis, FjObject, _strArrayA ,_strArrayB); end; function jMyHello.GetIntArray(): TDynArrayOfInteger; begin   //in designing component state: result value here...   if FInitialized then    Result:= jMyHello_GetIntArray(jForm(Owner).App.Jni.jEnv, jForm(Owner).App.Jni.jThis, FjObject); end; function jMyHello.GetSumIntArray(var _vA: TDynArrayOfInteger; var _vB: TDynArrayOfInteger; _size: integer): TDynArrayOfInteger; begin   //in designing component state: result value here...   if FInitialized then    Result:= jMyHello_GetSumIntArray(jForm(Owner).App.Jni.jEnv, jForm(Owner).App.Jni.jThis, FjObject, _vA ,_vB ,_size); end; procedure jMyHello.ShowHello(); begin   //in designing component state: set value here...   if FInitialized then      jMyHello_ShowHello(jForm(Owner).App.Jni.jEnv, jForm(Owner).App.Jni.jThis, FjObject); end; {-------- jMyHello_JNI_Bridge ----------} function jMyHello_jCreate(env: PJNIEnv; this: JObject;_Self: int64; _flag: integer; _hello: string): jObject; var   jParams: array[0..2] of jValue;   jMethod: jMethodID=nil;   jCls: jClass=nil; begin   jParams[0].j:= _Self;   jParams[1].i:= _flag;   jParams[2].l:= env^.NewStringUTF(env, PChar(_hello));   jCls:= Get_gjClass(env);   jMethod:= env^.GetMethodID(env, jCls, 'jMyHello_jCreate', '(JILjava/lang/String;)Ljava/lang/Object;');   Result:= env^.CallObjectMethodA(env, this, jMethod, @jParams);   Result:= env^.NewGlobalRef(env, Result); env^.DeleteLocalRef(env,jParams[2].l); end; (* //Please, you need insert:      public java.lang.Object jMyHello_jCreate(long _Self, int _flag, String _hello) {       return (java.lang.Object)(new jMyHello(this,_Self,_flag,_hello));    }   //to end of "public class Controls" in "Controls.java" *) procedure jMyHello_jFree(env: PJNIEnv; this: JObject; _jmyhello: JObject); var   jMethod: jMethodID=nil;   jCls: jClass=nil; begin   jCls:= env^.GetObjectClass(env, _jmyhello);   jMethod:= env^.GetMethodID(env, jCls, 'jFree', '()V');   env^.CallVoidMethod(env, _jmyhello, jMethod); end; procedure jMyHello_SetFlag(env: PJNIEnv; this: JObject; _jmyhello: JObject; _flag: integer); var   jParams: array[0..0] of jValue;   jMethod: jMethodID=nil;   jCls: jClass=nil; begin   jParams[0].i:= _flag;   jCls:= env^.GetObjectClass(env, _jmyhello);   jMethod:= env^.GetMethodID(env, jCls, 'SetFlag', '(I)V');   env^.CallVoidMethodA(env, _jmyhello, jMethod, @jParams); end; function jMyHello_GetFlag(env: PJNIEnv; this: JObject; _jmyhello: JObject): integer; var   jMethod: jMethodID=nil;   jCls: jClass=nil; begin   jCls:= env^.GetObjectClass(env, _jmyhello);   jMethod:= env^.GetMethodID(env, jCls, 'GetFlag', '()I');   Result:= env^.CallIntMethod(env, _jmyhello, jMethod); end; procedure jMyHello_SetHello(env: PJNIEnv; this: JObject; _jmyhello: JObject; _hello: string); var   jParams: array[0..0] of jValue;   jMethod: jMethodID=nil;   jCls: jClass=nil; begin   jParams[0].l:= env^.NewStringUTF(env, PChar(_hello));   jCls:= env^.GetObjectClass(env, _jmyhello);   jMethod:= env^.GetMethodID(env, jCls, 'SetHello', '(Ljava/lang/String;)V');   env^.CallVoidMethodA(env, _jmyhello, jMethod, @jParams); env^.DeleteLocalRef(env,jParams[0].l); end; function jMyHello_GetHello(env: PJNIEnv; this: JObject; _jmyhello: JObject): string; var   jStr: JString;   jBoo: JBoolean;   jMethod: jMethodID=nil;   jCls: jClass=nil; begin   jCls:= env^.GetObjectClass(env, _jmyhello);   jMethod:= env^.GetMethodID(env, jCls, 'GetHello', '()Ljava/lang/String;');   jStr:= env^.CallObjectMethod(env, _jmyhello, jMethod);   case jStr = nil of      True : Result:= '';      False: begin               jBoo:= JNI_False;               Result:= string( env^.GetStringUTFChars(env, jStr, @jBoo));             end;   end; end; function jMyHello_GetStringArray(env: PJNIEnv; this: JObject; _jmyhello: JObject): TDynArrayOfString; var   jStr: JString;   jBoo: JBoolean;   resultSize: integer;   jResultArray: jObject;   jMethod: jMethodID=nil;   jCls: jClass=nil;   i: integer; begin   jCls:= env^.GetObjectClass(env, _jmyhello);   jMethod:= env^.GetMethodID(env, jCls, 'GetStringArray', '()[Ljava/lang/String;');   jresultArray:= env^.CallObjectMethod(env, _jmyhello, jMethod);   resultsize:= env^.GetArrayLength(env, jresultArray);   SetLength(Result, resultsize);   for i:= 0 to resultsize - 1 do   begin     jStr:= env^.GetObjectArrayElement(env, jresultArray, i);     case jStr = nil of        True : Result[i]:= '';        False: begin                jBoo:= JNI_False;                Result[i]:= string( env^.GetStringUTFChars(env, jStr, @jBoo));               end;     end;   end; end; function jMyHello_ToUpperStringArray(env: PJNIEnv; this: JObject; _jmyhello: JObject; var _msgArray: TDynArrayOfString): TDynArrayOfString; var   jStr: JString;   jBoo: JBoolean;   resultSize: integer;   jResultArray: jObject;   jParams: array[0..0] of jValue;   jMethod: jMethodID=nil;   jCls: jClass=nil;   newSize0: integer;   jNewArray0: jObject=nil;   i: integer; begin   newSize0:= ?   jNewArray0:= env^.NewObjectArray(env, newSize0, env^.FindClass(env,'java/lang/String'),env^.NewStringUTF(env, PChar('')));   for i:= 0 to newSize0 - 1 do   begin      env^.SetObjectArrayElement(env,jNewArray0,i,env^.NewStringUTF(env, PChar(_msgArray[i])));   end;   jParams[0].l:= jNewArray0;   jCls:= env^.GetObjectClass(env, _jmyhello);   jMethod:= env^.GetMethodID(env, jCls, 'ToUpperStringArray', '([Ljava/lang/String;)[Ljava/lang/String;');   jResultArray:= env^.CallObjectMethodA(env, _jmyhello, jMethod,  @jParams);   resultSize:= env^.GetArrayLength(env, jResultArray);   SetLength(Result, resultSize);   for i:= 0 to resultsize - 1 do   begin     jStr:= env^.GetObjectArrayElement(env, jresultArray, i);     case jStr = nil of        True : Result[i]:= '';        False: begin                 jBoo:= JNI_False;                 Result[i]:= string( env^.GetStringUTFChars(env, jStr, @jBoo));               end;     end;   end; env^.DeleteLocalRef(env,jParams[0].l); end; function jMyHello_ConcatStringArray(env: PJNIEnv; this: JObject; _jmyhello: JObject; var _strArrayA: TDynArrayOfString; var _strArrayB: TDynArrayOfString): TDynArrayOfString; var   jStr: JString;   jBoo: JBoolean;   resultSize: integer;   jResultArray: jObject;   jParams: array[0..1] of jValue;   jMethod: jMethodID=nil;   jCls: jClass=nil;   newSize0: integer;   jNewArray0: jObject=nil;   newSize1: integer;   jNewArray1: jObject=nil;   i: integer; begin   newSize0:= ?   jNewArray0:= env^.NewObjectArray(env, newSize0, env^.FindClass(env,'java/lang/String'),env^.NewStringUTF(env, PChar('')));   for i:= 0 to newSize0 - 1 do   begin      env^.SetObjectArrayElement(env,jNewArray0,i,env^.NewStringUTF(env, PChar(_strArrayA[i])));   end;   jParams[0].l:= jNewArray0;   newSize1:= ?   jNewArray1:= env^.NewObjectArray(env, newSize0, env^.FindClass(env,'java/lang/String'),env^.NewStringUTF(env, PChar('')));   for i:= 0 to newSize1 - 1 do   begin      env^.SetObjectArrayElement(env,jNewArray1,i,env^.NewStringUTF(env, PChar(_strArrayB[i])));   end;   jParams[1].l:= jNewArray1;   jCls:= env^.GetObjectClass(env, _jmyhello);   jMethod:= env^.GetMethodID(env, jCls, 'ConcatStringArray', '([Ljava/lang/String;[Ljava/lang/String;)[Ljava/lang/String;');   jResultArray:= env^.CallObjectMethodA(env, _jmyhello, jMethod,  @jParams);   resultSize:= env^.GetArrayLength(env, jResultArray);   SetLength(Result, resultSize);   for i:= 0 to resultsize - 1 do   begin     jStr:= env^.GetObjectArrayElement(env, jresultArray, i);     case jStr = nil of        True : Result[i]:= '';        False: begin                 jBoo:= JNI_False;                 Result[i]:= string( env^.GetStringUTFChars(env, jStr, @jBoo));               end;     end;   end; env^.DeleteLocalRef(env,jParams[0].l);   env^.DeleteLocalRef(env,jParams[1].l); end; function jMyHello_GetIntArray(env: PJNIEnv; this: JObject; _jmyhello: JObject): TDynArrayOfInteger; var   resultSize: integer;   jResultArray: jObject;   jMethod: jMethodID=nil;   jCls: jClass=nil; begin   jCls:= env^.GetObjectClass(env, _jmyhello);   jMethod:= env^.GetMethodID(env, jCls, 'GetIntArray', '()[I');   jresultArray:= env^.CallObjectMethod(env, _jmyhello, jMethod);   resultsize:= env^.GetArrayLength(env, jresultArray);   SetLength(Result, resultsize);   env^.GetIntArrayRegion(env, jResultArray, 0, resultSize, @Result[0] {target}); end; function jMyHello_GetSumIntArray(env: PJNIEnv; this: JObject; _jmyhello: JObject; var _vA: TDynArrayOfInteger; var _vB: TDynArrayOfInteger; _size: integer): TDynArrayOfInteger; var   resultSize: integer;   jResultArray: jObject;   jParams: array[0..2] of jValue;   jMethod: jMethodID=nil;   jCls: jClass=nil;   newSize0: integer;   jNewArray0: jObject=nil;   newSize1: integer;   jNewArray1: jObject=nil; begin   newSize0:= ?   jNewArray0:= env^.NewIntArray(env, newSize0);  // allocate   env^.SetIntArrayRegion(env, jNewArray0, 0 , newSize0, @_vA[0] {source});   jParams[0].l:= jNewArray0;   newSize1:= ?   jNewArray1:= env^.NewIntArray(env, newSize1);  // allocate   env^.SetIntArrayRegion(env, jNewArray1, 0 , newSize1, @_vB[0] {source});   jParams[1].l:= jNewArray1;   jParams[2].i:= _size;   jCls:= env^.GetObjectClass(env, _jmyhello);   jMethod:= env^.GetMethodID(env, jCls, 'GetSumIntArray', '([I[II)[I');   jResultArray:= env^.CallObjectMethodA(env, _jmyhello, jMethod,  @jParams);   resultSize:= env^.GetArrayLength(env, jResultArray);   SetLength(Result, resultSize);   env^.GetIntArrayRegion(env, jResultArray, 0, resultSize, @Result[0] {target});   env^.DeleteLocalRef(env,jParams[0].l);   env^.DeleteLocalRef(env,jParams[1].l); end; procedure jMyHello_ShowHello(env: PJNIEnv; this: JObject; _jmyhello: JObject); var   jMethod: jMethodID=nil;   jCls: jClass=nil; begin   jCls:= env^.GetObjectClass(env, _jmyhello);   jMethod:= env^.GetMethodID(env, jCls, 'ShowHello', '()V');   env^.CallVoidMethod(env, _jmyhello, jMethod); end; end. ---------------------------------------------------------------------- jmpessoa · 2014-05-07 01:27 Hi, Given a suggestion and request by Fatih KILIÇ ... I made a minor update of  Android Module Wizard.... Now the Version 0.5 {rev. 01 - 06 May 2014} Add Partial Support for Menu Object [Option Menu/SubMenu and Context Menu]....       :: NEW jMenu Component [Android Bridges Extra]       :: NEW AppMenuDemo [Eclipse Project] Please, ref: https://github.com/jmpessoa/lazandroidmodulewizard Thanks! PS. @Stephano: first we would need to define a new architecture: application model, form model and component model.... soon as possible I will try to investigate the way that you propose. Thank you! ---------------------------------------------------------------------- Fatih KILIÇ · 2014-05-07 07:29 Hi jmpessoa. I have tested AppMenuDemo eclipse project. Very good work for me. Thank you for your evaluates my suggestion and request. Note: When I select menu from title bar the menu and submenu is works fine, but when i select menu from hardware MENU button the submenu can't dispayed. ---------------------------------------------------------------------- Fatih KILIÇ · 2014-05-07 07:33 Also, i examine your wrapper class. Really that very big work. Good works. ---------------------------------------------------------------------- jmpessoa · 2014-05-08 12:45 @ Fatih KILIÇ Code: [Select]....when i select menu from hardware MENU button the submenu can't dispayed.... Yes, the support for icon/drawable is very partial.... Please, verify that you have "ic_launcher.png" in all  ....\res\drawable-xxxx  folders. Thank you. ---------------------------------------------------------------------- Leledumbo · 2014-06-07 17:16 Latest commit (may 8th) + today's lazarus svn causes access violation whenever I drop any control. Best stack trace I can get: QuoteAddComponent jTextView Parent=MainModule:TMainModule 164,103,0,0 Parent is 'nil' TMainIDE.OnPropHookPersistentAdded A jTextView1:jTextView [TEventsCodeTool.CompleteComponent]  CurComponent=jTextView1:jTextView Program received signal SIGSEGV, Segmentation fault. 0x0000000000891747 in CUSTOMFORMEDITOR$_$TCUSTOMFORMEDITOR_$__$$_DOONN ODEGETIMAGEINDEX$TPERSISTENT$LONGINT () (gdb) bt #0  0x0000000000891747 in CUSTOMFORMEDITOR$_$TCUSTOMFORMEDITOR_$__$$_D OONNODEGETIMAGEINDEX$TPERSISTENT$LONGINT () #1  0x00007fffdafc7d40 in ?? () #2  0x00007fffdbeadbc0 in ?? () #3  0x00007fffdbf50410 in ?? () #4  0x00000000007c6f9f in OBJECTINSPECTOR$_$TOBJECTINSPECTORDLG_$__$$_ COMPONENTTREEGETNODEIMAGEINDEX$TPERSISTENT$LONGINT () #5  0x0000000000000001 in ?? () #6  0x0000000000cbf6b4 in COMPONENTTREEVIEW$_$TCOMPONENTTREEVIEW_$__$$ _GETIMAGEFOR$TPERSISTENT$$LONGINT () #7  0x0000000000000001 in ?? () #8  0x00007fffdbeadbc0 in ?? () #9  0x00007fffdb631c00 in ?? () #10 0x0000000000cbe3ff in COMPONENTTREEVIEW$_$TCOMPONENTWALKER_$__$$_WALK$TCOMPONENT () #11 0x00007fffffffc708 in ?? () #12 0x00007fffffffc7f8 in ?? () ---Type to continue, or q to quit--- #13 0x00007fff00000001 in ?? () #14 0x00007fffdb631c00 in ?? () #15 0x00007fffffffc7c0 in ?? () #16 0x00007fffdbeadbc0 in ?? () #17 0x00007fffdbeadbc0 in ?? () #18 0x00007ffff7fc34c0 in ?? () #19 0x00007fffffffd800 in ?? () #20 0x00007fffffffc6f0 in ?? () #21 0x0000000000cbe345 in COMPONENTTREEVIEW$_$TCOMPONENTWALKER_$__$$_WALK$TCOMPONENT () #22 0x0000000000000000 in ?? () ---------------------------------------------------------------------- jmpessoa · 2014-06-07 18:19 Ok, I'll try to see what's happening.... Thank you! ---------------------------------------------------------------------- Leledumbo · 2014-06-08 11:08 Works fine in 1.2.2, so I guess it's something changed in svn. It's up to you though, whether you want to make it compatible or not. ---------------------------------------------------------------------- jmpessoa · 2014-06-08 17:13 Good News! Thank you! PS. I am working in next generation: the form designer is on the way! ---------------------------------------------------------------------- Stephano · 2014-06-08 22:33 @Leledumbo, Did you recompile the IDE clean? I did and the IDE aborts the compilation (panic). ---------------------------------------------------------------------- Leledumbo · 2014-06-09 10:20 Quote from: Stephano on June 09, 2014, 12:33:58 am@Leledumbo, Did you recompile the IDE clean? I did and the IDE aborts the compilation (panic). Yes, I build from fresh svn source and fresh 1.2.2 source using FPC 2.7.1 of quite recent (no less than a week) revision. ---------------------------------------------------------------------- Stephano · 2014-06-09 14:59 i used svn from 2 days ago. The IDE fails to build when this package is installed. ---------------------------------------------------------------------- Leledumbo · 2014-06-09 16:21 Probably just an intermittent bug. Anyway, since it doesn't work as well in lazarus svn, you don't have to try further. Stick with 1.2.2 instead. ---------------------------------------------------------------------- Stephano · 2014-06-09 19:32 Stable versions are for the faint hearted  I hope this gets fixed soon. ---------------------------------------------------------------------- Leledumbo · 2014-06-11 16:17 @jmpessoa, First, are you going to concentrate on the visual designer and abandon the existing lazandroidmodule? Or will it be another package that depends on lazandroidmodule? Second, I have found a (probably) bug. wgRadioButton in ListView doesn't act like a radio button. Selecting one doesn't deselect the others and there's no way to set checked state from code. I see Java code for this in Controls.java but jListView hasn't wrapped the method yet. Third, will you add Spinner? I need a combobox like structure. Right now, I have to abuse list view a bit. Last but not least, how do you create user defined dialog? ---------------------------------------------------------------------- jmpessoa · 2014-06-11 17:02 Hi Leledumbo, 1. No, I am not will abandon the existing lazandroidmodule. The existents projects will load in the next generation. 2. I will return to jListView  code and try fix this bug. 3. I wil try implement the Spinner. 4. how do you create user defined dialog? The paradigm is the same: Java warapper (added to "controls.java") and Pascal "bridge" Component. I Will try implement an example. Thank you! PS: "For all" Just of curiosity : Someone tried to build your own component? Lazarus Android Wizard now offers two new aid/assistance to increase the productivity of coding. 1.You can now produce a almost complete pascal JNI component code from a java wrapper class! 2.You can now get assistance for produce the java warapper class! Please, read the new "fast_tutorial_jni_bridges_component_create.txt" for more info! EDIT_1 :: Rapid fix to jListView :: "Controls.java" ref. line 1779: Code: [Select]class jListItemRow{ String label; int    id; int widget = 0;        //Added code :: needed to fix  the RadioButton Group default behavior: thanks to View jWidget;  // << Added here !!!       ...........       ........... } ref: line 2014:: View.OnClickListener getOnCheckItem(final View cb, final int position)                  Code: [Select]...... ...... else if (cb.getClass().getName().equals("android.widget.RadioButton")) { //new code: fix to RadioButton Group  default behavior: thanks to Leledumbo. boolean doCheck = ((RadioButton)cb).isChecked(); //new code                                                   for (int i=0; i < items.size(); i++) {    ((RadioButton)items.get(i).jWidget).setChecked(false);    items.get(i).checked = false;                 }                   items.get(position).checked = doCheck; ((RadioButton)cb).setChecked(doCheck);                                   controls.pOnClickWidgetItem(PasObj, position, ((RadioButton)cb).isChecked());                   } //end else to "android.widget.RadioButton" ..... .... ---------------------------------------------------------------------- jmpessoa · 2014-06-14 04:52 Hi All! I did an update "Android Module Wizard"   :: New Add [Partial] Support for Spinner Object //<<---- A suggestion and request by Leledumbo       :: NEW jSpinner Component [Android Bridges EXtra]       :: NEW AppSpinnerDemo [Eclipse Project]       :: NEW AppListViewDemo [Eclipse Project]          fix RadioButton behavior...//<<---- A suggestion and request by Leledumbo       :: Warning: Bluetooth support yet unfinished! [BUG?]! ref. https://github.com/jmpessoa/lazandroidmodulewizard Thanks to All! ---------------------------------------------------------------------- Leledumbo · 2014-06-14 18:19 Thanks for the update. One more thing, could you research on how to handle Java exceptions? ATM, every Java exception will crash the app so we need a mechanism to handle it. Pascal exceptions can of course be handled by Pascal code. ---------------------------------------------------------------------- jmpessoa · 2014-06-14 23:37 @Leledumbo [and All], OK. Have you some new component requirement? Thanks! ---------------------------------------------------------------------- Leledumbo · 2014-06-15 02:55 Quote from: jmpessoa on June 15, 2014, 01:37:03 am@Leledumbo [and All], OK. Have you some new component requirement? Thanks! Hmm...not yet so far, just that exception handling. I have a little improvement idea, not in the code, but the build process. You can run ProGuard since not all classes, methods, etc. are used. This can reduce the final result size. I want to ask one thing, how to use toast? It's a bit unclear to me. It should be a class with class method in the Android Java documentation. ---------------------------------------------------------------------- jmpessoa · 2014-06-19 12:59 @Leledumbo, Code: [Select]....You can run ProGuard since not all classes... Nice! great info! Quotehow to use toast? I implemented the standard "ShowMessage" as a jForm method: line: 417 Code: [Select]public void ShowMessage(String msg){ Log.i("ShowMessage:", msg);     Toast.makeText(controls.activity, msg, Toast.LENGTH_SHORT).show(); } Where "controls.activity"  is the "fresh"  java Context  maintained over the entire framework designer ... You can put this code: Code: [Select]Toast.makeText(controls.activity, "my message", Toast.LENGTH_SHORT).show();  inside any method for other jobjects in "Controls.java"! See lines 5024/5120 [jMyHello] For jForm Pascal side there is: Quoteprocedure jForm.ShowMessage(msg: string); begin   UpdateJNI(gApp);  // << ---- "refresh" Context!   jForm_ShowMessage(Self.App.Jni.jEnv, Self.App.Jni.jThis,  FjObject, msg); end; Where the last is the Pascal JNI API: Code: [Select]procedure jForm_ShowMessage(env:PJNIEnv; this:jobject; Form:jObject; msg: string); var    cls: jClass;    method: jmethodID;     _jParams : Array[0..0] of jValue; begin    _jParams[0].l:= env^.NewStringUTF(env, pchar(msg) );   cls := env^.GetObjectClass(env, Form);   method:= env^.GetMethodID(env, cls, 'ShowMessage', '(Ljava/lang/String;)V');env^.CallVoidMethodA(env,            Form, method,@_jParams);   env^.DeleteLocalRef(env,_jParams[0].l); end; Thank you! PS1. In future we may consider including  in the template "Controls.java" [in designe time] only the classes used by project... so we will have more custom Apps. PS2. The next generation [form designer] is coming soon! Will be much more fun to program for android! ---------------------------------------------------------------------- Fatih KILIÇ · 2014-07-09 08:54 Hi, When I set jTextView.Text property by turkish characters set, the characters's view is incorrect. Is this a bug? How do I solve this problem? Note: The .pas file is saved in UTF8 format. Code: [Select]jTextView.Text := 'İETT Otobüs Sefer Bilgisi (iettosb), İETT''nin yurt içi taşımacılığı...'; Screen View: İETT Otobüs Sefer Bilgisi (iettosb), İETT''nin yurt içi taşımacılığı' + ---------------------------------------------------------------------- tk · 2014-07-09 12:02 Source file encoding must be UTF8. Try with our without BOM. Debug in assembly. Check if there is no conversion routine called like fpc_ansi_str* or similar. ---------------------------------------------------------------------- Fatih KILIÇ · 2014-07-09 12:37 Thanks tk. As you said, I removed related section and problem solved. File: Laz_And_Controls.pas Code: [Select]Procedure jTextView.SetText(Value: string); begin   FText:= Value; //utf8encode(Value);  // Removed.   if FInitialized then     jTextView_setText2(jForm(Owner).App.Jni.jEnv, jForm(Owner).App.Jni.jThis, FjObject, FText); end; ---------------------------------------------------------------------- Fatih KILIÇ · 2014-07-23 19:33 Hi, jmpessoa. 1. Can you adapt below java code or improved related function to the Android Module Wizard in the fashion GetIntData, SetIntData, GetStringData, SetStringData, GetBoolData, SetBoolData? 2. Can you add GPS component to the Android Module Wizard? Thanks. Code: [Select] private static int getIntData(Context context, String Key, int defValue) { SharedPreferences sPref = PreferenceManager .getDefaultSharedPreferences(context); return sPref.getInt(Key, defValue); } private static void setIntData(Context context, String Key, int Value) { SharedPreferences sPref = PreferenceManager .getDefaultSharedPreferences(context); SharedPreferences.Editor edt = sPref.edit(); edt.putInt(Key, Value); edt.commit(); } private static String getStringData(Context context, String Key, String defValue) { SharedPreferences sPref = PreferenceManager .getDefaultSharedPreferences(context); return sPref.getString(Key, defValue); } private static void setStringData(Context context, String Key, String Value) { SharedPreferences sPref = PreferenceManager .getDefaultSharedPreferences(context); SharedPreferences.Editor edt = sPref.edit(); edt.putString(Key, Value); edt.commit(); } private static boolean getBoolData(Context context, String Key, boolean defValue) { SharedPreferences sPref = PreferenceManager .getDefaultSharedPreferences(context); return sPref.getBoolean(Key, defValue); } private static void setBoolData(Context context, String Key, boolean Value) { SharedPreferences sPref = PreferenceManager .getDefaultSharedPreferences(context); SharedPreferences.Editor edt = sPref.edit(); edt.putBoolean(Key, Value); edt.commit(); } ---------------------------------------------------------------------- jmpessoa · 2014-07-23 21:42 Ok Fatih , I will try! Thank you! ---------------------------------------------------------------------- jmpessoa · 2014-08-18 04:10 Hi All! There is an updated version of "Android Module Wizard"       :: New jLocation Component: Add Partial Support for Location Object //<<---- A suggestion and request by Fatih KILIÇ       :: New jPreference Component: Add Partial Support for Preferences Object //<<---- A suggestion and request by Fatih KILIÇ       :: NEW AppLocationDemo [Eclipse Project]  --- see picture attached ref. https://github.com/jmpessoa/lazandroidmodulewizard Thanks to All! ---------------------------------------------------------------------- Leledumbo · 2014-08-18 04:29 Quote from: jmpessoa on August 18, 2014, 06:10:31 amHi All! There is an updated version of "Android Module Wizard"       :: New jLocation Component: Add Partial Support for Location Object //<<---- A suggestion and request by Fatih KILIÇ       :: New jPreference Component: Add Partial Support for Preferences Object //<<---- A suggestion and request by Fatih KILIÇ       :: NEW AppLocationDemo [Eclipse Project]  --- see picture attached ref. https://github.com/jmpessoa/lazandroidmodulewizard Thanks to All! Congratulations! How's the GUI designer progress? ---------------------------------------------------------------------- Fatih KILIÇ · 2014-08-20 08:02 Thanks jmpessoa for taking valuable time. Become a beautiful work. I wish you continued efforts. ---------------------------------------------------------------------- jmpessoa · 2014-09-02 19:16 Hi! Code: [Select]...How's the GUI designer progress? I'm still working .... you can already see some results [attached figures] Thanks! ---------------------------------------------------------------------- Fatih KILIÇ · 2014-09-04 09:51 Hi. Q1. My there are two form. First form (TAndroidModule1) opens second form (TAndroidModule3). Second form must result value to the first form. Below codes is insufficient. How two form are synchronize the value? (global.SelectedHat) Form1 Code: [Select]procedure TAndroidModule1.DataModuleClickContextMenuItem(Sender: TObject;   jObjMenuItem: jObject; itemID: integer; itemCaption: string; checked: boolean   ); begin   if(itemID = 10) then   begin     if(AndroidModule3 = nil) then     begin       gApp.CreateForm(TAndroidModule3, AndroidModule3);       AndroidModule3.Init(gApp);     end else AndroidModule3.Show;   end;   // global variable   edtHat.Text := global.SelectedHat; end; Form2 Code: [Select]procedure TAndroidModule3.jListView1ClickCaptionItem(Sender: TObject;   Item: integer; caption: string); begin   // global variable   global.SelectedHat := caption;   Close; end; Q2: Second problem is when add item jListView above 512 the program is crach. Error is: "E/dalvikvm(3819): Failed adding to JNI local ref table (has 512 entries)" How resolve these problem. Thanks. ---------------------------------------------------------------------- jmpessoa · 2014-09-06 03:34 Hi Fatih, Q1. :: I Added Unit "global" for TAndroidModule1 unit AND for TAndroidModule3 unit: my test was OK!!! Q2: In line "6355" of  "And_jni_Bridge.pas", See my code and the FIX: Code: [Select]Procedure jListView_add2(env:PJNIEnv;this:jobject; ListView: jObject; Str: string; delimiter: string); var   _jMethod: jMethodID = nil;   _jParams: array[0..1] of jValue;   cls: jClass; begin   _jParams[0].l := env^.NewStringUTF(env, pchar(Str) );   _jParams[1].l := env^.NewStringUTF(env, pchar(delimiter) );   cls := env^.GetObjectClass(env, ListView);   _jMethod:= env^.GetMethodID(env, cls, 'add2', '(Ljava/lang/String;Ljava/lang/String;)V');   env^.CallVoidMethodA(env,ListView,_jMethod,@_jParams);   env^.DeleteLocalRef(env,_jParams[0].l);   env^.DeleteLocalRef(env,_jParams[1].l);   env^.DeleteLocalRef(env, cls);  // <---- Added this for bug fix! 09-Sept-2014 [Thanks to  @Fatih!] end;  Please, do this for others jListView_add* too! Thank you! ---------------------------------------------------------------------- Fatih KILIÇ · 2014-09-06 08:16 Thanks jmpessoa jListView1.Add problem is solved. Also i'm waiting updated lazandroidmodule for global unit. A suggestion: improving of ListView widget will helpful. ---------------------------------------------------------------------- jmpessoa · 2014-09-06 12:09 Hi Fatih, about Q1: No, there will be NO update for global unit .... I just tried to redo the path that you were trying to do .... and managed to get the expected result! For test  I just used this code: Code: [Select]unit Global; {$mode delphi} interface uses   Classes, SysUtils; var   SelectedHat: string; implementation end. Thank you! ---------------------------------------------------------------------- Fatih KILIÇ · 2014-09-07 08:13 Hi, jmpessoa When I click TAndroidModule3.jListView (TAndroidModule3.jListView1ClickCaptionItem) the Form2 (TAndroidModule3) is closed, global.SelectedHat variable is empty and edtHat.Text (jEditText) control value is showing blank value. I think there are synchronize problem? I could not find a solution. Thank you. ---------------------------------------------------------------------- jmpessoa · 2014-09-07 18:52 Hi Fatih, please, try this: Code: [Select]Unit3 interface   ............................ ............................ implementation uses Unit1;   //< ------ put it! procedure TAndroidModule3.jListView1ClickCaptionItem(Sender: TObject;   Item: integer; caption: string); begin   // global variable   global.SelectedHat := caption;   Unit1.edtHat.Text := global.SelectedHat;  ////< ------ put it!   Close; end; Thank you! PS. As soon as possible, I will try a more architectural synchronization solution! EDITED: Ok, here's a more elegant solution: Code: [Select]TAndroidModule1 = class(jForm)     private       {private declarations}     public       {public declarations}       Procedure MyCallBack(Sender: TObject);  //<--- your call back function! end;  implementation Procedure TAndroidModule1.MyCallBack(Sender: TObject); begin    jEditText1.Text:= global.SelectedHat; end;  procedure TAndroidModule1.DataModuleClickContextMenuItem(Sender: TObject;   jObjMenuItem: jObject; itemID: integer; itemCaption: string; checked: boolean); begin   if(itemID = 10) then   begin     if(AndroidModule3 = nil) then     begin         gApp.CreateForm(TAndroidModule3, AndroidModule3);         AndroidModule3.SetCloseCallBack(MyCallBack, nil);  //<<-- [delphi sintaxe mode]!         AndroidModule3.Init(gApp);     end else AndroidModule3.Show;   end;   // global variable   //edtHat.Text := global.SelectedHat; //<<---- this line never was called! end; Thank you! ---------------------------------------------------------------------- Fatih KILIÇ · 2014-09-08 08:00 Hi, jmpessoa. Different and interesting a solution but synchronization solution is more beautiful. I wish you continued your work. Thank you. ======================== NOTE: LATER ADDED SECTION Bug: EditText1Change events is not triggers. Code: [Select]procedure TAndroidModule3.jEditText1Change(Sender: TObject;   EventType: TChangeType); begin   case EventType of     ctChangeBefore: ShowMessage('ctChangeBefore event occurs');     ctChange: ShowMessage('ctChange event occurs');     ctChangeAfter: ShowMessage('ctChangeAfter event occurs');   end; end; ---------------------------------------------------------------------- Leledumbo · 2014-09-14 11:34 I add a readme.md for easier reading in the github page, the readme.txt looks clumsy to me. ---------------------------------------------------------------------- greenzyzyzy · 2014-09-17 16:03 why it show me 'src folder not found'  ?  Project -> New Project  JNI Android Module  Next...  show error.... another question: when will have form designer?is it in this year? ---------------------------------------------------------------------- jmpessoa · 2014-09-17 16:41 Hi greenzyzyzy, Q1: the " Next..." is a form like this (?!): http://jmpessoa.opendrive.com/files?Ml8zNzM2NzE1OV9YdHJXaw --"Path to Workplace" ? --"Selected"  project  Name ? -- Eclipse or Ant Project? Please, see: "fast_tutorial_eclipse_users.txt" and/or "fast_tutorial_ant_users.txt" and/or Q2:  Very soon! Thank you! ---------------------------------------------------------------------- greenzyzyzy · 2014-09-17 16:54 error show after 'Select java source' this form,press ok then show error. ---------------------------------------------------------------------- Fatih KILIÇ · 2014-09-17 19:02 Hi, greenzyzyzy. Please watch below video. http://www.youtube.com/watch?v=sQnFYJyltwY&list=UUkQrLhaIXrKY4eq9zTymx pQ ---------------------------------------------------------------------- greenzyzyzy · 2014-09-18 02:40 thanks jmpessoa and Fatih KILIÇ, problem solved. ---------------------------------------------------------------------- greenzyzyzy · 2014-09-18 04:22 Q1:does Android Module Wizard can use TBitmap?not jBitmap. Q2:does Android Module Wizard can use any other laz4android lcl? ---------------------------------------------------------------------- jmpessoa · 2014-09-18 16:38 Hi greenzyzyzy, In my experiments, all LCL dependencies failed! Thank you! PS. LCLBase ( LResources) is OK, for component icon!       flc-image is OK!       freetype is OK (please, see in this forum!) ---------------------------------------------------------------------- greenzyzyzy · 2014-09-19 02:33 Quote from: jmpessoa on September 18, 2014, 06:38:01 pmHi greenzyzyzy, In my experiments, all LCL dependencies failed! Thank you! PS. LCLBase ( LResources) is OK, for component icon!       flc-image is OK!       freetype is OK (please, see in this forum!) some of Android Module Wizard components' property and method is missing ,will add them?for example jbitmap is not have savetostream and loadfromstream. ---------------------------------------------------------------------- jmpessoa · 2014-09-20 22:32 Yes, greenzyzyzy Whenever possible (time is always a important variable ...) I will implement new methods and properties to all components... Specifically, if you point out the context in which you need to use jbitmap it would be important. I can try implement your request... Thank you! ---------------------------------------------------------------------- greenzyzyzy · 2014-09-21 10:45 thanks for your work!nothing  important i need.i only hope your program will be perfect. ---------------------------------------------------------------------- Stygian · 2014-09-25 06:15 Hello, I have a question about Laz4android. Can I use the offical build Lazarus(now 1.2.4 with FPC 2.6.4)? Or you build is a must. Thanks, Stygian ---------------------------------------------------------------------- greenzyzyzy · 2014-09-25 14:46 sorry i do not know,because i am a newer too. ---------------------------------------------------------------------- jmpessoa · 2014-09-25 16:23 No,  You will need fpc 2.7.1 + cross arm/x86  libs for android..... the simplest way is to get this one: https://sourceforge.net/projects/laz4android/files/?source=navbar --->>>    win32/Android NDK-9/{ARM and x86 !} :: Thanks to TrueTom! Welcome! ---------------------------------------------------------------------- Leledumbo · 2014-09-25 16:37 Quote from: Stygian on September 25, 2014, 08:15:30 amCan I use the offical build Lazarus(now 1.2.4 with FPC 2.6.4)? Lazarus 1.2.4 is OK, but FPC must be 2.7.1 since 2.6.4 contains no proper Android support. ---------------------------------------------------------------------- Stygian · 2014-09-25 17:50 Thanks for the answer. Maybe others already said it but there is a bug in the Android Modul configure window. The Ant and SDK browse buttons are swapped. ---------------------------------------------------------------------- greenzyzyzy · 2014-09-27 09:20 Quote from: jmpessoa on September 18, 2014, 06:38:01 pmHi greenzyzyzy, In my experiments, all LCL dependencies failed! Thank you! PS. LCLBase ( LResources) is OK, for component icon!       flc-image is OK!       freetype is OK (please, see in this forum!) old question,does TBitmap or TMemoryStream can use in Android Module Wizard? it seems it is compiled ok.but i have not test.have you test? ---------------------------------------------------------------------- jmpessoa · 2014-10-02 17:20 Hi! I'm preparing a major change for Android Module Wizard: the form designer is here! However, before upgrading the github repository, I would like some feedback, mainly due to compatibility issues!    :: New Android Widgets Fom Designer! //<<--- thanks to LiteZarus by x2nie!       -->> Windows Users: Get LiteZarus4Android [Lazarus 1.3 + x2nie patch [No LCLform design] + TrueTom fpc 2.7.1 cross Arm/x86/android/]                         ::To Install, please, read the "LiteZarus4Android_readme.txt"       Download from: [EDITED!]                 https://onedrive.live.com/redir?resid=78D6F726E8F0C522%21236       -->> Linux Users: Get Lazarus 1.3 rev >= 45216,45217 ... and fpc 2.7.1 cross /arm/x86/android ... etc          1. Guide line for "Old" Projects [Collateral Effects] --- *Please make a backup* !!       -->> Some TAndroidModule form properties was supressed!          Please, no panic! When prompt "Read error" [Unknown Property] just choice "Continue Loading" !       -->> Components conteiners behavior [jPanel e jScrollView] :  remove and put [again] yours controls into them!                       -->> Now adjust yours widgets, the concept continue the same:          .LayoutParamWidth/LayoutParamHeight          .Anchor          .PosRelativeToAnchor          .PosRelativeToParent       -->> Add new "AndroidWidget" unit to uses clauses [*.dpr/*.pas]    2. NEWS !!       -->> The form *.lfm parse now is OK !!!       -->> AppTest1 [eclipse project] :: jPanel and form close/callback demo...                       form1 design : https://jmpessoa.opendrive.com/files?Ml82NTQ0NDMxNl9CV292dg                       form1 Screen : https://jmpessoa.opendrive.com/files?Ml82NTQ0NDM2OV9SUVJ1NA                       form2 design : https://jmpessoa.opendrive.com/files?Ml82NTQ0Nzk5N19RbXFjVw                       form2 Screen : https://jmpessoa.opendrive.com/files?Ml82NTQ0NzQ3NF9wMGhHcQ                           -->> AppCameraDemo [eclipse project] :: jPanel and jCamera demo       -->> AppDemo1 [eclipse project] was adjusted/updated !         3. Download  "NEW" Android Module Wizard - version 0.6: [EDITED!]        https://onedrive.live.com/redir?resid=78D6F726E8F0C522%21237    4. Download  demos: [EDITED!]             https://onedrive.live.com/redir?resid=78D6F726E8F0C522%21238 Thanks to All! ---------------------------------------------------------------------- luri · 2014-10-03 02:17 all download link: "This item might not exist or is no longer available" ---------------------------------------------------------------------- jmpessoa · 2014-10-03 03:14 Hi luri,  I Edited the links! Thank you! ---------------------------------------------------------------------- xinyiman · 2014-10-04 18:06 Sorry, but I can not find clear documentation and well-argued on this topic. How to start from scratch? ---------------------------------------------------------------------- jmpessoa · 2014-10-04 18:41 Hi xinyiman, there are: "readme.txt" "fast_tutorial_eclipse_users.txt" "fast_tutorial_ant_users.txt" ref. folder "LazAndroidWizard"  [ https://onedrive.live.com/redir?resid=78D6F726E8F0C522%21237] But If you can enumerate your questions I can try to help! Welcome! ---------------------------------------------------------------------- greenzyzyzy · 2014-10-10 13:03 Quote from: jmpessoa on October 04, 2014, 08:41:04 pmHi xinyiman, there are: "readme.txt" "fast_tutorial_eclipse_users.txt" "fast_tutorial_ant_users.txt" ref. folder "LazAndroidWizard"  [ https://onedrive.live.com/redir?resid=78D6F726E8F0C522%21237] But If you can enumerate your questions I can try to help! Welcome! sorry , i can not open this link. can you add the program to https://github.com/jmpessoa/lazandroidmodulewizard  ? ---------------------------------------------------------------------- jmpessoa · 2014-10-10 16:33 Hi  greenzyzyzy, can you try this? https://jmpessoa.opendrive.com/files?Ml82NTcyMDQ3MV84bEk5bQ or https://www.mediafire.com/?cuban3u110gnolb I'll try to do an GITHUB update later this week .... The demos is here: http://www.mediafire.com/download/y6w8pie3h1k15ux/demos_eclipse_projec ts_02_october_2014.rar Thank you! ---------------------------------------------------------------------- thierrydijoux · 2014-10-11 10:19 Hi, I played with android during 1 week, using Android Module Wizard. Very nice tool ! I'm using the ant process to compile and build apk. I have questions about themes. I'm trying using the Holo theme light, but i always have froyo style interfaces. Did someone succeeded to apply native theme (i targeted android 4.4 in sdk target). And what about strings.xml, i don't know if it's possible to get values from strings.xml to have multi language interfaces. If it's possible and if someone has a piece of code to show... Thanks in advance ---------------------------------------------------------------------- Leledumbo · 2014-10-11 15:12 Quote from: thierrydijoux on October 11, 2014, 12:19:47 pmAnd what about strings.xml, i don't know if it's possible to get values from strings.xml to have multi language interfaces. If it's possible and if someone has a piece of code to show... Thanks in advance Since AMW use LCL style resources, I think you should use the same approach for multilingual apps. The same way as the desktop apps. The problem is everytime you change strings.xml, R.java is automatically regenerated and you will need a dynamic JNI wrapper to be able to call the entries in the R class. It's not impossible, but you will need R.java JNI wrapper. ---------------------------------------------------------------------- jmpessoa · 2014-10-11 16:03 Hi, @thierrydijoux, You can try modify this line, Code: [Select] android:theme="@style/AppTheme" > in "AndroidManifest.xml" Well, You can try change "styles.xml" too:  [ .....\res\values\styles.xml ] @Leledumbo, you got played with new "form designer" version?  Thanks! ---------------------------------------------------------------------- thierrydijoux · 2014-10-11 19:37 @jmpessoa and @Leledumbo :Thanks for your reply @Leledumbo : how can i have or genrate the R.java JNI wrapper ? I think it's the same thing for all resources (bitmap etc). Managing translations in the generated .so is not really a problem, but managing bitmap for different screens resolutions can be tricky. I think the R.java JNI wrapper could be quite usefull. @jmpessoa : have you try to access the android actionbar with fpc ? ---------------------------------------------------------------------- Leledumbo · 2014-10-12 03:37 Quote from: jmpessoa on October 11, 2014, 06:03:28 pm@Leledumbo, you got played with new "form designer" version?  Is it in the github already? Quote from: thierrydijoux on October 11, 2014, 09:37:04 pm@Leledumbo : how can i have or genrate the R.java JNI wrapper ? I think it's the same thing for all resources (bitmap etc). Managing translations in the generated .so is not really a problem, but managing bitmap for different screens resolutions can be tricky. I think the R.java JNI wrapper could be quite usefull. The same as creating other JNI wrapper. jmpessoa should be able to tell you what to do to create a JNI wrapper in general with his AMW. ---------------------------------------------------------------------- xinyiman · 2014-10-12 13:10 Hello guys, I'm trying to follow this video guide when I install the package lazandroidwizardpack me this error C: \ laz4android \ components \ LazAndroidWizard \ androidwizard_intf.pas (166.15) Error: There is no method in an ancestor class to be overridden: "GetObjInspNodeImageIndex (TPersistent; LongInt var);" I'm on windows xp How can I fix? thanks ---------------------------------------------------------------------- greenzyzyzy · 2014-10-12 15:05 Quote from: jmpessoa on October 10, 2014, 06:33:56 pmHi  greenzyzyzy, can you try this? https://jmpessoa.opendrive.com/files?Ml82NTcyMDQ3MV84bEk5bQ or https://www.mediafire.com/?cuban3u110gnolb I'll try to do an GITHUB update later this week .... The demos is here: http://www.mediafire.com/download/y6w8pie3h1k15ux/demos_eclipse_projec ts_02_october_2014.rar Thank you! ok,downloaded. thank you. ---------------------------------------------------------------------- jmpessoa · 2014-10-12 16:12 Hi xinyiman, please, read this:  -->> Windows Users: Get LiteZarus4Android [Lazarus 1.3 + x2nie patch [No LCLform design] + TrueTom fpc 2.7.1 cross Arm/x86/android/]                         ::To Install, please, read the "LiteZarus4Android_readme.txt"       Download from: [EDITED!]                 https://onedrive.live.com/redir?resid=78D6F726E8F0C522%21236                         :: right click to download!         -->> Linux Users: Get Lazarus 1.3 rev >= 45216,45217 ... and fpc 2.7.1 cross /arm/x86/android ... etc Thank you! ---------------------------------------------------------------------- xinyiman · 2014-10-12 17:19 Quote from: jmpessoa on October 12, 2014, 06:12:35 pmHi xinyiman, please, read this:  -->> Windows Users: Get LiteZarus4Android [Lazarus 1.3 + x2nie patch [No LCLform design] + TrueTom fpc 2.7.1 cross Arm/x86/android/]                         ::To Install, please, read the "LiteZarus4Android_readme.txt"       Download from: [EDITED!]                 https://onedrive.live.com/redir?resid=78D6F726E8F0C522%21236         -->> Linux Users: Get Lazarus 1.3 rev >= 45216,45217 ... and fpc 2.7.1 cross /arm/x86/android ... etc Thank you! Thank you! ---------------------------------------------------------------------- xinyiman · 2014-10-12 19:21 A curiosity, if I have a project already created how can I bring up the configuration wizard for android? ---------------------------------------------------------------------- jmpessoa · 2014-10-12 20:03 @xinyiman, sorry, I do Not understand! An old Eclipse project? An old Eclipse project + LazWizardModule project? ---------------------------------------------------------------------- xinyiman · 2014-10-13 13:03 For example, if I want to change the setting of '"Android Module Wizard" to one of the examples that you make available to learn. How can I do? ---------------------------------------------------------------------- jmpessoa · 2014-10-13 17:17 Hi xinyiman, The example projects do not depends of the "Android Module Wizard" configuration [paths etc..]... if you install is ok, then just open the lazarus project in "\jni" folder ["controls.lpi"] .... now you can modify it! To produce new modified android Apk 1. Just use eclipse to import the example project .... after do  "->refresh"  and "->run" it! 2. Or just use java "ant"  utility..... Thank you! ---------------------------------------------------------------------- xinyiman · 2014-10-14 10:48 ok, but when I go to "Build" tells me that there is no output folder C:\adt32\eclipse\workspace\AppSqliteDemo1\jni Where do I go to change the destination folder? ---------------------------------------------------------------------- jmpessoa · 2014-10-14 17:53 Hi  xinyiman, 1. Is you using eclipse? 2. You imported the project to eclipse? 3. If  (1 and 2) = yes, then open the lazarus project and "save all" to the new \jni path.... 4. Go to Lazarus IDE ->Project ->Project -> Option ->Path Change this information for correct one! "C:\adt32\ndk7" "C:\adt32\eclipse\workspace" Thank You! PS.  Quote"C:\adt32\eclipse\workspace" Is my "eclipse workspace" with I have set in  Android Module Wizard  config path dialog....   Quote "C:\adt32\ndk7"Is my "NDK" path with I have set in  Android Module Wizard  config path dialog.... What is your eclipse workspace path...? What is your NDK path...? ---------------------------------------------------------------------- xinyiman · 2014-10-15 13:03 Ok change, but other error. Why? Error: Path "C:\adt32\eclipse\workspace\AppSqliteDemo1\libs\armeabi\" does not exist ---------------------------------------------------------------------- Leledumbo · 2014-10-15 13:08 Quote from: xinyiman on October 15, 2014, 03:03:59 pmOk change, but other error. Why? Error: Path "C:\adt32\eclipse\workspace\AppSqliteDemo1\libs\armeabi\" does not exist Adjust those paths to YOUR installation. ---------------------------------------------------------------------- xinyiman · 2014-10-15 13:09 where? ---------------------------------------------------------------------- Leledumbo · 2014-10-15 13:34 Quote from: xinyiman on October 15, 2014, 03:09:39 pmwhere? I don't know, it's your computer, not mine. You should know by yourself despite the hardcoded paths in the examples. ---------------------------------------------------------------------- xinyiman · 2014-10-15 13:49 But I have changed the paths That I have said jmpessoa but WHEN do you build tells me this. ---------------------------------------------------------------------- BigChimp · 2014-10-15 14:19 May be a good idea to indicate where you changed what exactly. ---------------------------------------------------------------------- xinyiman · 2014-10-15 14:36 Io ho cambiato le mie impostazioni in questi posti Quote from: jmpessoa on October 14, 2014, 07:53:17 pmHi  xinyiman, Lazarus ->Project ->Project -> Option ->Path Change this information for correct one! "C:\adt32\ndk7" "C:\adt32\eclipse\workspace" ---------------------------------------------------------------------- jmpessoa · 2014-10-15 15:35 Hi xinyiman QuoteError: Path "C:\adt32\eclipse\workspace\AppSqliteDemo1\libs\armeabi\" does not exist Open/edit the "controls.lpi" [...\jni],  you can use Notepad like editor.... Modify some [piece] of path information [C:\adt32\eclipse\workspace] according to your system .. ---------------------------------------------------------------------- xinyiman · 2014-10-16 13:35 Quote from: jmpessoa on October 15, 2014, 05:35:04 pmHi xinyiman QuoteError: Path "C:\adt32\eclipse\workspace\AppSqliteDemo1\libs\armeabi\" does not exist Open/edit the "controls.lpi" [...\jni],  you can use Notepad like editor.... Modify some [piece] of path information [C:\adt32\eclipse\workspace] according to your system .. It's ok! But when I install the package on my android (2.3.6) phone I get this message "problem with the analysis of the packet" why?! ---------------------------------------------------------------------- jmpessoa · 2014-10-16 19:39 Hi All! There is a  MAJOR Android Module Wizard update! Please, ref: https://github.com/jmpessoa/lazandroidmodulewizard Version 0.6 - 15 October 2014 -    1. NEW !!       -->> Android Widgets Fom Designer! //<<--- thanks to LiteZarus by x2nie!                       form1 design : https://jmpessoa.opendrive.com/files?Ml82NTQ0NDMxNl9CV292dg                       form1 Screen : https://jmpessoa.opendrive.com/files?Ml82NTQ0NDM2OV9SUVJ1NA                       form2 design : https://jmpessoa.opendrive.com/files?Ml82NTQ0Nzk5N19RbXFjVw                       form2 Screen : https://jmpessoa.opendrive.com/files?Ml82NTQ0NzQ3NF9wMGhHcQ       -->> Windows Users: Get LiteZarus4Android          [Lazarus 1.3 + x2nie patch [No LCLform design] +          TrueTom fpc 2.7.1 cross Arm/x86/android/]          :DOWNLOAD from: https://onedrive.live.com/redir?resid=78D6F726E8F0C522%21236 [right click to download!]          :To Install, please, read the "LiteZarus4Android_readme.txt"          1. From LiteZarus4Android IDE - Install Wizard Packages          1.1 Package -> Open Package -> "tfpandroidbridge_pack.lpk"  [Android Components Bridges!]             Ref. image: https://www.opendrive.com/files?Ml8zNjMwNDQ3NF83SzhsZg          1.1.1 From Package Wizard             - Compile             - Use -> Install           1.2 Package -> Open Package -> "lazandroidwizardpack.lpk"             1.2.1 From Package Wizard             - Compile             - Use -> Install             HINT: to compile/install/reinstall a package in LiteZarus4Android,             please, open a "dummy" windows project....             you always MUST close the cross compile project!        -->> Linux Users: Get Lazarus 1.3 rev >= 45216,45217 ... and fpc 2.7.1 cross /arm/x86/android ... etc.    2. NEW !!       -->> AppTest1 [eclipse project] :: jPanel and form close/callback demo...       -->> AppTest2 [eclipse project]::Present direct/hack JNI access and a new component implementation                   model "laz_and_jni_controls.pas" [not java wrapper at all!]                   [--->> A suggestion and request by Stephano]                        -->> All Apps Demos [Eclipse projects] was adjusted/updated !        -->> All project now support Ant "build.*" "intall.*" etc..          :warning: if needed change this files according to your system!    3. Guide line for "Old" Projects [Collateral Effects]       -->> Some TAndroidModule Form properties was supressed!                 -->> Some jComponents properties was supressed!          Please, no panic! When prompt "Read error" [Unknown Property] just choice "Continue Loading" !       -->> Components conteiners behavior [jPanel e jScrollView] :  remove and put [again] yours controls into them!                      -->> Now adjust yours widgets, the concept continue the same:          .LayoutParamWidth/LayoutParamHeight          .Anchor          .PosRelativeToAnchor          .PosRelativeToParent          WARNING: android's "wildcards" [WrapContent and lpMatchParent] overlaps the design vision!                and more: if this properties values are achieved, the "Object Inspector" will "freeze"                this value! To "unfreeze" not just change by design, you will need                change the value in OI by hand to any other value, so it will adjust correctly!       -->> Add new "AndroidWidget" unit to uses clauses [*.dpr/*.pas]    4. How to use the Demos:       Change this information to correct one!          "C:\adt32\ndk7"   -- just my system NDK path          "C:\adt32\eclipse\workspace"  -- just my system eclipse workspace       1. Go to Lazarus IDE          ->Project          ->Project -> Option          ->Path          change/modify paths according to your system ..       2. Open/edit the "controls.lpi" [...\jni],  you can use Notepad like editor....          Modify some [piece] of path information          [C:\adt32\eclipse\workspace]          [C:\adt32\ndk7]          according to your system ..            3. For Ant users: Change/edit build.* , intall.* , unistall.*, logcat.*  according to your system!                                       5.FIXs [BUGS]          -->> The form *.lfm parse now is OK !!!       -->> jListView bug fix[check/not checkd]          and new added properties: "HighLightSelectedItem" [True/False] and "HighLightSelectedItemColor" Thanks to All! ---------------------------------------------------------------------- chenyuchih · 2014-10-16 23:45 OH MY GOODNESS! Nice Job! Thanks for your hard works for this! ---------------------------------------------------------------------- Leledumbo · 2014-10-17 03:22 Seems like the form designer is in github already. I'm pulling... ---------------------------------------------------------------------- jmpessoa · 2014-10-17 18:48 Hi! 1. Fix a minor bug in "controls.dpr" generated code: commented the "datetime" in the "first" line!   [thanks to Stephano!] 2. The AppAntDemo1 was updated! [thanks to Stephano!] Thanks to All! ---------------------------------------------------------------------- xinyiman · 2014-10-18 19:56 According to me you could create a virtual machine that has as its sole purpose is to create Android applications with this tool. It would be good to do it in linux (any version). Because the end user to program interesting and not realize the development environment. What do you say, someone wants to do it? But then to be kept up to date. I guarantee that many would use it. ---------------------------------------------------------------------- Fred vS · 2014-10-18 21:31 Hello  Are you using/testing Android on VirtualBox ? I have install android-x86-4.4-RC1.iso on VirtualBox-linux-Mint/64bit, it works sometimes but it has lot of crash too.  Do you have a better iso ? Thanks. ---------------------------------------------------------------------- jmpessoa · 2014-10-19 01:12 @xinyiman, @Fred vS I do not use virtual machine/box.... I have not thought about this possibility or necessity... 1. To make android App: -----On windows you can try: LiteZarus4Android [Lazarus 1.3 + x2nie patch [No LCLform design] + TrueTom fpc 2.7.1 cross Arm/x86/android/] :DOWNLOAD from: https://onedrive.live.com/redir?resid=78D6F726E8F0C522%21236 [right click to download!] :To Install, please, read the "LiteZarus4Android_readme.txt" ----On Linux: get Lazarus 1.3 rev >= 45216,45217 ... and fpc 2.7.1 cross /arm/x86/android ... etc. 2. To Run/Test App: -->> Emulator -->> Real Device [my is Galaxy S3 / android 4.3] Greetings! ---------------------------------------------------------------------- greenzyzyzy · 2014-10-19 01:47 Quote from: xinyiman on October 12, 2014, 03:10:35 pmHello guys, I'm trying to follow this video guide when I install the package lazandroidwizardpack me this error C: \ laz4android \ components \ LazAndroidWizard \ androidwizard_intf.pas (166.15) Error: There is no method in an ancestor class to be overridden: "GetObjInspNodeImageIndex (TPersistent; LongInt var);" I'm on windows xp How can I fix? thanks i got the same problem,if i do not want to use LiteZarus4Android,can i mark this codes  out? ---------------------------------------------------------------------- jmpessoa · 2014-10-19 03:11 Well, you just need Lazarus 1.3 rev >= 45216,45217 But,  LiteZarus4Android [win32]  is a cross compile package!      = Lazarus 1.3 rev >= 45216,45217  +         TrueTom fpc 2.7.1 cross Arm/x86/android/  [for NDK 9b] Greetings! PS. Precisely the  [@x2nie] patch is a contribution to No LCLform design ["GetObjInspNodeImageIndex" ... etc ]! ---------------------------------------------------------------------- truetom · 2014-10-19 05:20 Hello all, I have updated laz4android to new version. Date:2014-10-18 FPC: 2.7.1 SVN 28863  win32/arm-android/i386-android/jvm-android Lazarus:1.3 trunk svn 46592 Android NDK: r10c (arm-linux-androideabi-4.6 + x86-4.6) 2014-10-18: 1.Fixed examples\androidlcl,now it can compatible with this version. 2.Compatible with Jmpessoa's LazAndroidModuleWizard,thanks Jmpessoa and Simonsays. the Link: http://sourceforge.net/projects/laz4android/files/?source=navbar Thanks and best regards! ---------------------------------------------------------------------- jmpessoa · 2014-10-19 11:44 Hi TrueTom! I Will add support [Android Module Wizard] for this new release! I will try it today! Thank you again! ---------------------------------------------------------------------- jmpessoa · 2014-10-20 02:48 Hi! I have updated [github] Android Module Wizard! NEW! Added support to the new [TrueTom] Laz4android QuoteLazarus:1.3 trunk svn 46592 + FPC: 2.7.1 SVN 28863  win32/arm-android/i386-android/jvm-android Android Ndk 10c http://sourceforge.net/projects/laz4android/files/?source=navbar Thanks! ---------------------------------------------------------------------- Leledumbo · 2014-10-20 05:58 Clicking OK in the wizard (after filling required fields) terminates IDE instantly. Lazarus svn 46619, FPC svn 28884. I'll try to get a proper backtrace. EDIT: this is the best I can get: Code: [Select]lazarus.pp - unhandled exception [TMainIDE.Destroy] A Runtime error 210 at $0000000000425BFC   $0000000000425BFC   $00000000004B1778 line 3764 of main.pp   $00000000004A278F line 1569 of main.pp   $0000000000516CED   $00000000004354D0   $000000000046D0F9 line 39 of qt/interfaces.pp   $000000000043993]   $0000000000425BFC   $00000000008FE888 line 4201 of objectinspector.pp   $00000000009151D8 line 6250 of propedits.pp ---------------------------------------------------------------------- xinyiman · 2014-11-02 08:27 Hello guys I'm doing some tests to start from scratch with a project. And when I create a new project I create the file controls.lpr fact, when I create the package apk and install it on my smart phone will not let me open. Who tells me why? I used the settings for gingerbread. ---------------------------------------------------------------------- xinyiman · 2014-11-02 17:12 So I'm making progress, I installed everything. I tried to create a blank application and I build the apk file. If I add a button that launches a ShowMessage goes wrong. Download soirce : www.lazaruspascal.it/download_personali/prova_tel.zip Who tells me why? ---------------------------------------------------------------------- jmpessoa · 2014-11-02 18:13 Hi  xinyiman, A strange thing I noticed in your code "Unit1.lfm" : Code: [Select]Anchor = jButton1 Try remove this settings [go to Object Inspector and set this property to (none)/blanck] I think, it can not be anchored himself! But it can be "anchored" to the parent, example: set property PosRelativeToParent = [rpCenterInParent] Thank you! ---------------------------------------------------------------------- xinyiman · 2014-11-02 19:04 I've already tried that ... the apk file I create it but when compiling it says that my source has errors ---------------------------------------------------------------------- jmpessoa · 2014-11-02 19:13 Ok, can you put here the "error message"? ---------------------------------------------------------------------- xinyiman · 2014-11-02 19:23 How do I? There are practical Eclipse ---------------------------------------------------------------------- xinyiman · 2014-11-02 19:30 Description   Resource   Path   Location   Type Call requires API level 17 (current min is 14): android.widget.EditTex t#setTextAlignment   Controls.java   /telapp1/src/ft/android/telapp1    line 8840   Android Lint Problem Call requires API level 17 (current min is 14): android.widget.TextVie w#setTextAlignment   Controls.java   /telapp1/src/ft/android/telapp1    line 8539   Android Lint Problem ---------------------------------------------------------------------- jmpessoa · 2014-11-02 20:15 Ok, You're trying to build "Apk" using "ant"  [build.bat] ? If  true, go to  "build.xml"  and try: Code: [Select] ---------------------------------------------------------------------- xinyiman · 2014-11-02 22:34 how build apk using ant? ---------------------------------------------------------------------- jmpessoa · 2014-11-02 22:53 Open  "build.xml"  and change to:  [all in project folder!] Code: [Select] Simply run "build.bat"  --->> build Apk Simply run "install.bat"  --->> install Apk on device or emulator ---------------------------------------------------------------------- xinyiman · 2014-11-03 10:41 result Code: [Select]C:\Users\generico\workspace\provaace>build.bat C:\Users\generico\workspace\provaace>set path=C:\android\ant\bin C:\Users\generico\workspace\provaace>set JAVA_HOME=C:\Program Files\Java\jdk1.8. 0_25 C:\Users\generico\workspace\provaace>cd C:\Users\generico\workspace\provaace C:\Users\generico\workspace\provaace>ant -Dtouchtest.enabled=true debug Buildfile: C:\Users\generico\workspace\provaace\build.xml -set-mode-check: -set-debug-files: -check-env:  [checkenv] Android SDK Tools Revision 23.0.2  [checkenv] Installed at C:\android\sdk -setup:      [echo] Project Name: provaace   [gettype] Project Type: Application -set-debug-mode: -debug-obfuscation-check: -pre-build: -build-setup: [getbuildtools] Using latest Build Tools: 20.0.0      [echo] Resolving Build Target for provaace... [gettarget] Project Target:   Android 4.2.2 [gettarget] API level:        17      [echo] ----------      [echo] Creating output directories if needed...     [mkdir] Created dir: C:\Users\generico\workspace\provaace\bin\rsObj     [mkdir] Created dir: C:\Users\generico\workspace\provaace\bin\rsLibs      [echo] ----------      [echo] Resolving Dependencies for provaace... [dependency] Library dependencies: [dependency] No Libraries [dependency] [dependency] ------------------      [echo] ----------      [echo] Building Libraries with 'debug'...    [subant] No sub-builds to iterate on -code-gen: [mergemanifest] Found Deleted Target File [mergemanifest] Merging AndroidManifest files into one. [mergemanifest] Manifest merger disabled. Using project manifest only.      [echo] Handling aidl files...      [aidl] No AIDL files to compile.      [echo] ----------      [echo] Handling RenderScript files...      [echo] ----------      [echo] Handling Resources...      [aapt] Generating resource IDs...      [aapt] C:\Users\generico\workspace\provaace\res\values-v11\styles.xml:7: er ror: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.      [aapt] C:\Users\generico\workspace\provaace\res\values-v14\styles.xml:8: er ror: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. BUILD FAILED C:\android\sdk\tools\ant\build.xml:653: The following error occurred while execu ting this line: C:\android\sdk\tools\ant\build.xml:698: null returned: 1 Total time: 5 seconds C:\Users\generico\workspace\provaace> ---------------------------------------------------------------------- jmpessoa · 2014-11-03 11:25 The gingerbread is the question! Please,  go to AndroidManifest.xml change to: [9 or 10?] Code: [Select]   Please,  go to  "...\res\values"  folder change "styles.xml" to: Code: [Select]