Hi Stephano, [and All!]
I tried to answer your questions!
[yes, the Leledumbo pointed the right and direct way!]
Please, get a new revision:
ref.
https://github.com/jmpessoa/lazandroidmodulewizardVersion 0.6 - rev. 18 - 22 February 2015 -
::Tutorial to Stephano Questions:
1. Create a new "Lamw" project as usual [save all to ../jni]
2. Add to ../src the new java class code [ex. jhelloadder.java]
3. Go to [again] IDE->Project->New Project select [again] "JNI Android Module" Project
and [again] Select the same project [form workspace]
4. But, NOW double click the added java class code [jhelloadder.java]
5. Ok
6. Save all new project to ../jni [warning: keep the project name [jhelloadder.lpr],
but change the unit name :: ex. "unithelloadder.pas"]
7. Yes, the new "jhelloadder.lpr" have the "drafts" code for all native methods!
function Add(PEnv: PJNIEnv; this: JObject; _a: JInt; _b: JInt): JInt; cdecl;
begin
{your code....}
{Result:= ;}
end;
function StringUpperCase(PEnv: PJNIEnv; this: JObject; _str: JString): JString; cdecl;
begin
{your code....}
{Result:= ;}
end;
8. Yes, you have a new form [datamodule]: You can put there any "pure/fcl" TComponent descendant!
[not LCL component, not Lamw component] --->> TODO: need more test
9. Go to [again] IDE->Tools->Android Module Wizard->New jComponent [Create]
10. Paste the "jhelloadder.java" into Tab "java" ...
WARNING: after paste, remove de word "public" from class definition!
[TODO: need fix the parse ...]
11. Read the content of Tab "help" ... [follow the instructions!]
Do not forget:
//Please, you need insert:
public java.lang.Object jHelloAdder_jCreate(long _Self) {
return (java.lang.Object)(new jHelloAdder(this,_Self));
}
//to end of "public class Controls" in "Controls.java"
12. Open "tfpandroidbridge_pack.lpk --> More -> Recompile Clean -> Use -> Install !!
13. Use Case 1: Pascal call Java :: drop the new component to jForm [main app] and use it!
14. Use case 2. Java call Java :: declare and use it! ex.:
jHelloAdder helloadder;
helloadder = new jHelloAdder(controls, 1010); //controsl=reference to main "controls" object :: 1010 = dummy
Log.i("jHelloAdder_Add","Add(7,11)="+ helloadder.Add(7,11));
15. Please, see the new project demo ...
NEW! Demo AppAddSingleLibraryDemo1 [Eclipse Compatible Project]
Thank you!
PS. Yes, I will try a more simple [solution] library [no form at all!] just pure ".so"