Recent

Author Topic: Android Module Wizard  (Read 705554 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Android Module Wizard
« Reply #660 on: October 10, 2015, 07:40:49 pm »
One question , I have not yet figured out how to change the version number of my application . I thought he did on automatically each compilation , but I do not think so . Because when I go to install the apk file on my Android device did not update the version . Why? Who tells me how to do?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Android Module Wizard
« Reply #661 on: October 10, 2015, 11:04:48 pm »
Other question. How view a static image into my project?
Project name is jni/img/logo.png

Thank you
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: Android Module Wizard
« Reply #662 on: October 11, 2015, 05:57:25 am »
Hello  xinyiman!

I have not yet figured out how to change the version number... too, sorry.  :-[

About Image:

1. Put your image into folders "..\res\drawable-xhdpi"  etc.... example: "ic_launcher.png"

then [in design time .... or in run time "OnJNIPrompt"]:

Code: Pascal  [Select][+][-]
  1.  jImageView1.ImageIdentifier:= "ic_launcher";
  2.  

« Last Edit: October 11, 2015, 06:28:00 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

truetom

  • Jr. Member
  • **
  • Posts: 73
    • http://sourceforge.net/projects/laz4android/
Re: Android Module Wizard
« Reply #663 on: October 11, 2015, 07:44:24 am »
One question , I have not yet figured out how to change the version number of my application . I thought he did on automatically each compilation , but I do not think so . Because when I go to install the apk file on my Android device did not update the version . Why? Who tells me how to do?

Hello xinyiman,

You can open  the file AndroidManifest.xml , edit like this:
    android:versionCode="2"  //this is application version number.
    android:versionName="1.1"  //this is show to users , not really version number.

Thanks and best regards!
laz4android : a Lazarus for Android Package.
http://sourceforge.net/projects/laz4android/

almora

  • New member
  • *
  • Posts: 9
Re: Android Module Wizard
« Reply #664 on: October 11, 2015, 08:34:36 am »
Laz4android + Android Module Wizard + LazToApk  = android app.

Is this possible?
No eclipse install..

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: Android Module Wizard
« Reply #665 on: October 11, 2015, 05:38:15 pm »
Hello almora!

Yes, you can use  LazToApk to get the tools [sdk, ndk, ....]

and  Laz4android + Android Module Wizard to produce [bulid], run/install the apk!

From "readme_get_start.txt":

Quote
Here is a  rapid "get_start" for windows: "Laz4Android + Lazaru Azandroid Module Wizard"

Note 1:   for Linux:  go to " lazandroidmodulewizard folder  "...\linux"
   and read: "new_how_to_install_by_renabor.txt"

I. Infrastructure

.Java  sdk_x86 [32 bits]

.Android sdk, NDK-r10e

.Laz4Android [All in one!] =

                   Last update:2015-10-02
                   FPC: 3.1.1 trunk svn 31903 win32/arm-android/i386-android/jvm-android
                   Lazarus:1.5 trunk svn 49903
                   Android NDK: r10e (arm-linux-androideabi-4.9 + x86-4.9)
         :To Install [*.7z] --> "build.bat"

.Android sdk

.Android ndk-r10e   -    this version is required by "Laz4Android" 
         http://dl.google.com/android/ndk/android-ndk-r10e-windows-x86.exe

.Ant [to build Apk]
   http://ant.apache.org/bindownload.cgi
   Simply extract the zip file to a convenient location...

.Eclipse is not mandatory!  [but, to  facility, all projects [and Demos ] are Eclipse compatible!] 


II. LAMW:  Lazarus Android Module Wizard

   ref. https://github.com/jmpessoa/lazandroidmodulewizard

   .Install ordem.

      tfpandroidbridge_pack.lpk
      lazandroidwizardpack.lpk
      amw_ide_tools.lpk     [../ide-tools]

III. USE

1. Configure Paths:

   Lazarus IDE menu "Tools" ---> "[Lamw] Android Module Wizard" -->  "Path Settings ..."

2. New Project [thanks to @Developing!]     

   After install "LAMW" packages:

   2.1-From Lazarus IDE select "Project" -> "New Project"

   ref. https://jmpessoa.opendrive.com/files?Ml85OTEwMDQ3OV9BRW45VA

   2.2-From displayed dialog  select "JNI Android Module [Lamw GUI]"    


   2.3-Press OK Button.

   2.4. From form "Android Module wizard: Configure Project..." [Workspace Form]

      ref. https://jmpessoa.opendrive.com/files?Ml85OTEwMDU1Nl9YVE5qUg

   2.4-Fill/complete the field:
      "Path to workspace [project folder]" 
      example c:\LamwProjects

   2.5-Fill/complete the field:
      "New Project Name  [or Selec
      example: MyProject1
      [This is your Android App/Apk name]

   2.6-Select your Sdk [installed] Platform:
      example: Jelly Bean 4.1

   2.7-[MinSdk] Select the  min. Sdk Api to compile your project:
      example: 15

   2.8-[TagetApi] Select the target [api] device
      example: 19

   2.9-Select Instruction:
      example: ARMv6
      
        2.10. If Arm then Select Fpu:
      example: Soft

   2.11-Save All [unit1.pas] in path that is showed ...

3. From "Android Bridge" component tab drag/drop a jTextView in jForm
      set property: PosRelativeToParent  = [rpTop,rpCenterHorizontal]

4. From "Android Bridge" component tab drag/drop a jButton     in jForm
     set property: Anchor = jTextView1
     set property: PosRelativeToAnchor : [raBelow]
     set property:PosRelativeToParent = [rpCenter]
     write code for event property "OnClick"  =  ShowMessage('Hello!')

5.  Lazarus IDE menu "Run" ---> "Buld"   

6. Connect your Device to Computer [usb] and configure it to "debug mode"     

   "App settings"  ---> more/aditional -- developer options (*): 
   stay awake  [checked!]
   usb debugging [checked!]
   verify apps via usb [checked!]

   (*)PANIC! Go to Google search with "android usb debugging <device name>" to get the operating mode adapted to your device...
   
   ex. Galaxy S3/S4 --> app settings --> about -->> Build number -->> [tap,tap,tap,...]
        ex. MI 2 --> app settings --> about -->> MIUI Version -->> [tap,tap,tap,...]


7.Lazarus IDE menu "Run" ---> "[Lamw] Build Apk and Run" [Congratulations!!!]

8.PANIC!!! Fail to buid "Apk"

   .Try change project  "AndroidManifest.xml" according your system installation....

      <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="17"/>

      hint: other target:   "android:targetSdkVersion" !!
      
   .Change your project "build.xml"  according your system installation...

      <property name="target"  value="android-17"/>


9. How to configure a Demo to Use/Test:

      .Lazarus IDE menu Open a [*.lpi] Demo Project   [...\jni]

      .Lazarus IDE menu "Tools" ---> "[Lamw] Android Module Wizard" -->  "Change Project [*.lpi] Ndk Path"

      .set your "NDK" path!

      .change/edit project "build.xml"   according your system..

      <property name="sdk.dir" location="C:\adt32\sdk"/>


10. There are some others docs:   

   "install_tutorial.txt"
         and
   "install_tutorial_eclipse_users.txt"


Thank you!
« Last Edit: October 11, 2015, 06:03:38 pm by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 255
    • Fresh sound.
Re: Android Module Wizard
« Reply #666 on: October 11, 2015, 07:52:33 pm »
Hi,
would it be a big change to add "Android Module Wizard" and package "CustomDrawn"  into the Laz4Android package? (truetom??)
If this would be added, the user's could use laztoapk to get all stuff installed in one go?

Regards,
Sam
« Last Edit: October 13, 2015, 07:33:24 pm by DelphiFreak »
Linux Mint 20.3, Lazarus 2.3, Windows 10, Delphi 10.3 Rio, Delphi 11.1 Alexandria

almora

  • New member
  • *
  • Posts: 9
Re: Android Module Wizard
« Reply #667 on: October 12, 2015, 12:31:47 pm »
Thank you....

euller

  • New Member
  • *
  • Posts: 16
Re: Android Module Wizard
« Reply #668 on: October 15, 2015, 10:10:39 pm »
Just a silly question here:

About jForm.OnRotate(Sender: TObject; rotate: integer; var rstRotate: integer), apart from sender, what those parameters mean?
The best way to find a if a tool is faulty; is to use it in a stupid way for stupid purposes

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: Android Module Wizard
« Reply #669 on: October 16, 2015, 08:18:53 pm »
Hello Euller!

if rotate = 1 --> device is in vertical    [default position]

if rotate = 2 ->  device is in horizontal

 var rstRotate <<----  you can force to 1 or 2!    {default/indifferent = 0}

Note: You can try "AppCameraDemo" demo
« Last Edit: October 16, 2015, 09:24:27 pm by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Android Module Wizard
« Reply #670 on: October 17, 2015, 07:26:06 am »
Hello Euller!

if rotate = 1 --> device is in vertical    [default position]

if rotate = 2 ->  device is in horizontal

 var rstRotate <<----  you can force to 1 or 2!    {default/indifferent = 0}

Note: You can try "AppCameraDemo" demo
Wouldn't it be better to use enum instead of integer?

truetom

  • Jr. Member
  • **
  • Posts: 73
    • http://sourceforge.net/projects/laz4android/
Re: Android Module Wizard
« Reply #671 on: October 17, 2015, 02:21:17 pm »
Hello jmpessoa,

I have updated the new version laz4android-50093,
I also used the new LAMW which is download today.
But when I create new project with JNI Android Module (Lamw NoGUI or Lamw GUI),
it only show me a error : "List index (-1) out of bounds".
Please help me to fix this problem, thank you!

Thanks and best regards!
« Last Edit: October 17, 2015, 02:36:50 pm by truetom »
laz4android : a Lazarus for Android Package.
http://sourceforge.net/projects/laz4android/

euller

  • New Member
  • *
  • Posts: 16
Re: Android Module Wizard
« Reply #672 on: October 17, 2015, 02:26:39 pm »
Wouldn't it be better to use enum instead of integer?

I think the same way. This isn't the place to discuss where and when to use enums, but some meaningful names are helpful to the person using the tool. But this isn't a major flaw that compromises the usability of LAMW, it's just an odd design choice that isn't prejudicial to the development cycle.
The best way to find a if a tool is faulty; is to use it in a stupid way for stupid purposes

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: Android Module Wizard
« Reply #673 on: October 17, 2015, 03:30:50 pm »
@TrueTom

Quote
I create new project with JNI Android Module (Lamw NoGUI or Lamw GUI),
it only show me a error : "List index (-1) out of bounds".

Someone else has already reported this issue/bug ...I think it may be related to fill some listbox/combox in unit "uformworkspace.pas" ...  still can not identify why it occurs in some case ... I will continue trying to fix it!

@Euller and Leledumbo

Yes, the code has [some/many] immature design... all suggestions are welcome
[we can improve it]!

Thanks to All!
« Last Edit: October 17, 2015, 04:16:53 pm by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

euller

  • New Member
  • *
  • Posts: 16
Re: Android Module Wizard
« Reply #674 on: October 17, 2015, 04:18:00 pm »
An thing that I've just found about jDialogYN, let me show with some code

Code: Pascal  [Select][+][-]
  1. procedure TAndroidModule1.DoBar;
  2. begin
  3.    DoFoo('yeah');// something that may fail
  4.    jDialogYN1.Show
  5. end;
  6.  
  7. procedure TAndroidModule1.jDialogYN1ClickYN(Sender: TObject; YN: TClickYN);
  8. begin
  9.    if YN = clickNo then
  10.      DoBar
  11. end;
  12.  
  13. procedure TAndroidModule1.AndroidModule1JNIPrompt(Sender: TObject);
  14. begin
  15.    jDialogYN1.No:= 'No';
  16.    jDialogYN1.Yes:= 'Yes';
  17.    jDialogYN1.Msg:= 'The application has executed DoFoo?';
  18.    jDialogYN1.Title:= 'Foo';
  19. end;
  20.  

Well, this should create an loop, where DoBar calls DoFoo to do its thing that may fail, and that fail is obvious to the user, and then a dialog shows up asking the user if the operation was done. If it was, the program flow should return to normal, if it wasn't, DoBar is called again.

But I've noticed that, when I try to do it, there is no loop, jDialogYN1 is not showing again? Is that supposed to happens?
The best way to find a if a tool is faulty; is to use it in a stupid way for stupid purposes

 

TinyPortal © 2005-2018