Recent

Author Topic: Native Activity question|suggestion?  (Read 3031 times)

hinst

  • Sr. Member
  • ****
  • Posts: 303
Native Activity question|suggestion?
« on: September 21, 2013, 11:26:24 am »
I am currently looking at this article:
LCL-CustomDrawn-Android utilizes a minimal Java application which communicates with our Pascal library and sends all events to it and also obeys commands from it. The communication is done via JNI as supported by Google. The controls are not native, instead they are all drawing using TRawImage+TLazIntfImage+TLazCanvas and events and the painting are clipped using LazRegions. The drawing itself is done in Pascal using jnigraphics to draw on a Bitmap Java object which is then drawn by the minimal Java activity on a SurfaceView.
And also at this article:
Convenience for implementing an activity that will be implemented purely in native code. That is, a game (or game-like thing). There is no need to derive from this class; you can simply declare it in your manifest, and use the NDK APIs from there.
Maybe I'm missing something... but. Could it be that this Native Activity can be utilized to make development for Android significantly easier? The article on Lazarus Wiki (the one which I cited earlier in this post) implies that APK file should contain bot a native executable file (or dynamic library?) compiled by crossfpc-android-arm, and also a compiled java class (that is bytecode file). Which is (supposedly?) compiled by fpc-java (or how do I call this thing) compiler.

HOwEvEr, if one was to utilize NativeActivity stuff from that article (the one I cited earlier; at developer.android.com), there would be no need for any java classes in the APK archive. It says "A very simple example of native code that is run by NativeActivity follows." and the following code is in C. This means (again, I am not sure, maybe I'm missing something) that activity can be implemented either in C; and then one could create bindings for FPC, or it could be implemented entirely in FPC.

.........so there would be no need to mess with JAVA for those who want to develop android applications
« Last Edit: September 21, 2013, 11:28:16 am by hinst »
Too late to escape fate

Leledumbo

  • Hero Member
  • *****
  • Posts: 8317
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Native Activity question|suggestion?
« Reply #1 on: September 21, 2013, 05:05:23 pm »
Quote
The article on Lazarus Wiki (the one which I cited earlier in this post) implies that APK file should contain bot a native executable file (or dynamic library?) compiled by crossfpc-android-arm
dynamic library, and yes with fpc arm-android.
Quote
and also a compiled java class (that is bytecode file). Which is (supposedly?) compiled by fpc-java (or how do I call this thing) compiler.
Nope, it's compiled with Java compiler (ATM, though it's certainly possible to compile with fpc jvm-android, but the class file will depend on jvm-android rtl).
Quote
HOwEvEr, if one was to utilize NativeActivity stuff from that article (the one I cited earlier; at developer.android.com), there would be no need for any java classes in the APK archive. It says "A very simple example of native code that is run by NativeActivity follows." and the following code is in C. This means (again, I am not sure, maybe I'm missing something) that activity can be implemented either in C; and then one could create bindings for FPC, or it could be implemented entirely in FPC.

.........so there would be no need to mess with JAVA for those who want to develop android applications
There's an effort with example already, it builds and works fine, just need a few adjustments in the compiler option (since I use different FPU support option).

Seenkao

  • Full Member
  • ***
  • Posts: 127
Re: Native Activity question|suggestion?
« Reply #2 on: January 22, 2021, 06:16:09 pm »
There's an effort with example already, it builds and works fine, just need a few adjustments in the compiler option (since I use different FPU support option).
Thank you! The code works. :)

 

TinyPortal © 2005-2018