Recent

Author Topic: Android Module Wizard  (Read 705445 times)

m4u_hoahoctro

  • Full Member
  • ***
  • Posts: 160
Re: Android Module Wizard
« Reply #480 on: June 12, 2015, 11:39:06 am »
@ m4u_hoahoctro

here is a simple HttpClient and WebView demo ....

https://jmpessoa.opendrive.com/files?Ml85MDM4MzUyNV9lS2ZMTw


@jmpesssoa : thanks much  :D , now I feel if I want my app can connect to hosting and update, may be I must use SQL, so I will research about it  :)

m4u_hoahoctro

  • Full Member
  • ***
  • Posts: 160
Re: Android Module Wizard
« Reply #481 on: June 12, 2015, 03:19:32 pm »
@jmpessoa, I do a mediaplayer app using jsurface to play film file, but it show message: The end when I click on Play button ( checked radiobutton "Video" )

this is it, please test if I miss something

https://drive.google.com/file/d/0Bx3SDL5wwBBYTUFnMHBCWE0xQmM/view?usp=sharing
 
thanks

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: Android Module Wizard
« Reply #482 on: June 13, 2015, 07:46:39 pm »
@renabor

Quote
...Is it possible to automate the generation of a unique Id for the newly created object?

The unique ID is generated when you do a component "anchorage" ...

Quote
...the correct way to work with jHttpClient authentication ...

It is a server design/implementation question ... some server wait for :

SetAuthenticationHost('', -1);  //--> AuthScope(null, -1)   

Quote
...Can you extend the jHttpClient Class implementing the UPDATE and DELETE methods?

Ok. I will try .....

Quote
...I have many Forms in my app and I need different menu in each form, how can I achieve this result?

Ok. I am doing now ..... [adding support to ....]

Quote
...I use intensely jSqlLite and jHttpClient in any form of my app but I'm unable to share the first instance so I recreate it in every new form.  Is there a way to improve it?

You can try:  add "uses" [your first instance] after the "implementaion" section ...

Quote
...Can you suggest me a method to access Contacts for reading and writing them?

for reading [and pick]: it is supported in jIntentManager

for writing: Ok. I will do a jContactManager component ...

.....................

@m4u_hoahoctro

Please, put just "unit1.pas" and "unit1.lfm" .... [not a too big file !!!!]
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

m4u_hoahoctro

  • Full Member
  • ***
  • Posts: 160
Re: Android Module Wizard
« Reply #483 on: June 14, 2015, 01:55:21 am »


Quote

@m4u_hoahoctro

Please, put just "unit1.pas" and "unit1.lfm" .... [not a too big file !!!!]

ok. this is link download of above files:

https://drive.google.com/file/d/0Bx3SDL5wwBBYYVNYQ0R3VjVoUm8/view?usp=sharing

renabor

  • Jr. Member
  • **
  • Posts: 73
Re: Android Module Wizard
« Reply #484 on: June 14, 2015, 10:02:51 am »
@jmpessoa

Finally I got authentication working!

Changing Controls.java:

Code: [Select]
in class AsyncHttpClientPostNameValueData

after
                    HttpPost httppost = new HttpPost(_stringUrl);
adding this code:
                    if (mAuthenticationMode != 0) {
                            String _credentials = mUSERNAME + ":" + mPASSWORD;
                            String _base64EncodedCredentials = Base64.encodeToString(_credentials.getBytes(), Base64.NO_WRAP);
                            httppost.addHeader("Authorization", "Basic " + _base64EncodedCredentials);
                    }

Code: [Select]
in class AsyncHttpClientGet
after:
                    HttpGet httpget = new HttpGet(stringUrl[0]);
adding this code:
                    if (mAuthenticationMode != 0) {
                            String _credentials = mUSERNAME + ":" + mPASSWORD;
                            String _base64EncodedCredentials = Base64.encodeToString(_credentials.getBytes(), Base64.NO_WRAP);
                            httpget.addHeader("Authorization", "Basic " + _base64EncodedCredentials);
                    }
FPC 3.2.2 | Lazarus 2.2.3 | Kubuntu 22.04 64bit

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: Android Module Wizard
« Reply #485 on: June 15, 2015, 12:38:01 am »
Hi All!

There is a new  "Lamw" revision:
 
ref. https://github.com/jmpessoa/lazandroidmodulewizard

Version 0.6 - rev. 30 - 14 June 2015 -

   IMPROVEMENTS!   

      jMenu component:         
         New! Added support to different menu in each form! // <<--- @renabor's request and suggestion!
         New! Methods, Propery and Events
      jForm
         News! Events/Properties to handler the news from jMenu

   UPDATED: Demo AppMenuDemo

   FIXs   
      jForm      :fixed form close callback
      jHttpClient   :fixed "basic authentication" //<--- Thanks to @renabor !!!   

   HINT 1: Old Projects: upgrade your projects code templates !
      Lazarus IDE --> menu Tools --> [Lamw] Android Module Wizard --> Upgrade code Templates [*.lpr, *.java]

   HINT 2:   When prompt "Read error" [Unknown Property] just choice "Continue Loading"!

Thanks to All and special thanks to @renabor !!
« Last Edit: June 15, 2015, 03:53:26 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Công Tuấn

  • Newbie
  • Posts: 5
Re: Android Module Wizard
« Reply #486 on: June 16, 2015, 04:48:29 am »
@jmpessoa
How to open sdcard on android emulator?, i want to create folder and add image or video from computer to it :D

m4u_hoahoctro

  • Full Member
  • ***
  • Posts: 160
Re: Android Module Wizard
« Reply #487 on: June 16, 2015, 11:08:57 am »
@jmpessoa
How to open sdcard on android emulator?, i want to create folder and add image or video from computer to it :D

Đối với genymotion ( With genymotion emulator )http://stackoverflow.com/questions/18530114/accessing-files-from-genymotion-sd-card

Những máy ảo còn lại, bạn có thể sử dụng đường dẫn /sdcard/.... trong câu lệnh xử lý file khi cần )
( You can also use patch /sdcard/.... in progress command file in your application )
Dù vậy, các thử nghiệm sd card chỉ nên thực hiện trên thiết bị thực sẽ mang lại kết quả tốt hơn ( However, you should have a android phone to have a better result

« Last Edit: June 16, 2015, 05:26:10 pm by m4u_hoahoctro »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Android Module Wizard
« Reply #488 on: June 16, 2015, 12:42:31 pm »
In the latest commit, a hello world app seems to be caught in an infinite loop in both 4.2.2 emulator & 4.4.2 real device. I'm using a very fresh copy of FPC & Lazarus trunk, targetting ARMv7A + VFPv3. ADB says: "Skipping XX frames! The application may be doing too much work on its main thread."

m4u_hoahoctro

  • Full Member
  • ***
  • Posts: 160
Re: Android Module Wizard
« Reply #489 on: June 16, 2015, 05:29:39 pm »
In the latest commit, a hello world app seems to be caught in an infinite loop in both 4.2.2 emulator & 4.4.2 real device. I'm using a very fresh copy of FPC & Lazarus trunk, targetting ARMv7A + VFPv3. ADB says: "Skipping XX frames! The application may be doing too much work on its main thread."

Put your code here, I also want to see  the error you met
or you are meaning to helloword demo ?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Android Module Wizard
« Reply #490 on: June 17, 2015, 12:20:39 am »
In the latest commit, a hello world app seems to be caught in an infinite loop in both 4.2.2 emulator & 4.4.2 real device. I'm using a very fresh copy of FPC & Lazarus trunk, targetting ARMv7A + VFPv3. ADB says: "Skipping XX frames! The application may be doing too much work on its main thread."

Put your code here, I also want to see  the error you met
or you are meaning to helloword demo ?
Yes, that demo. I guess I build my FPC wrong because I recently played with raspberrypi which uses hard float. I'll try to rebuild.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: Android Module Wizard
« Reply #491 on: June 17, 2015, 01:46:07 am »
Well, I do a test just  NOW.... it seems continues running right ...

My systems:

Laz4Android
         Last update:2015-02-25
         FPC: 3.1.1 trunk svn 29987 win32/arm-android/i386-android/jvm-android
         Lazarus:1.5 trunk svn 47987
         Android NDK: r10c (arm-linux-androideabi-4.6 + x86-4.6)
         http://sourceforge.net/projects/laz4android/files/?source=navbar
         :To Install [*.7z], please, read the "Laz4Android_readme.txt"

and old:

Laz4Android [Laz 1.3 + FPC 2.7.1]

Devices: Android 4.3 and 4.4.2
« Last Edit: June 17, 2015, 01:57:24 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

m4u_hoahoctro

  • Full Member
  • ***
  • Posts: 160
Re: Android Module Wizard
« Reply #492 on: June 17, 2015, 09:33:46 am »
@jmpessoa

about my problem, have you found reason yet ? why it couldn't play video file ? I downloaded it from youtube  :(

ps: link of files unit1.lr and unit1.pas have been updated above
« Last Edit: June 17, 2015, 09:37:28 am by m4u_hoahoctro »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Android Module Wizard
« Reply #493 on: June 17, 2015, 03:33:18 pm »
Well, I do a test just  NOW.... it seems continues running right ...
My fault, indeed. I don't use any -Cp option anymore when building the compiler and rtl, only -Cf, and it works again.

renabor

  • Jr. Member
  • **
  • Posts: 73
Re: Android Module Wizard
« Reply #494 on: June 19, 2015, 09:04:30 am »
Hi All!

There is a new  "Lamw" revision:
 
ref. https://github.com/jmpessoa/lazandroidmodulewizard

Version 0.6 - rev. 30 - 14 June 2015 -

   IMPROVEMENTS!   

      jMenu component:         
         New! Added support to different menu in each form! // <<--- @renabor's request and suggestion!
         New! Methods, Propery and Events
      jForm
         News! Events/Properties to handler the news from jMenu

   UPDATED: Demo AppMenuDemo

   FIXs   
      jForm      :fixed form close callback
      jHttpClient   :fixed "basic authentication" //<--- Thanks to @renabor !!!   

   HINT 1: Old Projects: upgrade your projects code templates !
      Lazarus IDE --> menu Tools --> [Lamw] Android Module Wizard --> Upgrade code Templates [*.lpr, *.java]

   HINT 2:   When prompt "Read error" [Unknown Property] just choice "Continue Loading"!

Thanks to All and special thanks to @renabor !!

Thank you very much @jmpessoa, for code and cite!

I think something where wrong in the last revision that give me many problems and errors. I use rev. 29 once again.
The main problem reside in impossibility to upgrade Code Templates (Lazarus is unable to find Project file), and    throughout compiling report many Access Violation errors.

And now some suggestions, requests and bugs:
  • Add the OnBack Event In jCustomDialog
  • The function JNIPrompt is not fired when a form is reactivated trough a Back in a second form, solution could be to add an OnComingBack event to jForm, or firing JNIPrompt event on coming back. At this time data displayed cannot be refreshed in automatic on coming back to first form
  • The jContextMenu cannot open a form
  • When a jContextMenu is linked to a jListView would very helpful that the Caption of the Item clicked where accessible or passed. My need is to edit or delete the record associated with the item clicked
  • jListView is lacking in configurability in order to display many columns of data. What do you think about adding Columns or  something like Tab to jListView?
  • Add an onClick event to jEditText, to make it possible, i.e., to open in automatic a jDatePickerDialog
  • Add an itxCurrency mask for jEditText that admits dot and comma with numbers together, or add dot and comma to itxNumber

Best regards and thanks for all
« Last Edit: June 21, 2015, 10:28:12 am by renabor »
FPC 3.2.2 | Lazarus 2.2.3 | Kubuntu 22.04 64bit

 

TinyPortal © 2005-2018