unit ujdbcoracleconnection;
{$mode delphi}
interface
uses
Classes, SysUtils, And_jni, {And_jni_Bridge,} AndroidWidget;
type
{Draft Component code by "LAMW: Lazarus Android Module Wizard" [7/21/2024 7:34:18 AM]}
{https://github.com/jmpessoa/lazandroidmodulewizard}
{jControl template}
JdbcOracleConnection = class(jControl)
private
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Init; override;
procedure main(var args: TDynArrayOfString);
published
end;
procedure JdbcOracleConnection_main(env: PJNIEnv; _jdbcoracleconnection: JObject; var args: TDynArrayOfString);
implementation
{--------- JdbcOracleConnection --------------}
constructor JdbcOracleConnection.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
//your code here....
end;
destructor JdbcOracleConnection.Destroy;
begin
if not (csDesigning in ComponentState) then
begin
if FjObject <> nil then
begin
jFree();
FjObject:= nil;
end;
end;
//you others free code here...'
inherited Destroy;
end;
procedure JdbcOracleConnection.Init;
begin
if FInitialized then Exit;
inherited Init; //set default ViewParent/FjPRLayout as jForm.View!
//your code here: set/initialize create params....
FjObject := jCreate(); //jSelf !
if FjObject = nil then exit;
FInitialized:= True;
end;
procedure JdbcOracleConnection.main(var args: TDynArrayOfString);
begin
//in designing component state: set value here...
if FInitialized then
JdbcOracleConnection_main(gApp.jni.jEnv, FjObject, args);
end;
{-------- JdbcOracleConnection_JNI_Bridge ----------}
procedure JdbcOracleConnection_main(env: PJNIEnv; _jdbcoracleconnection: JObject; var args: TDynArrayOfString);
var
jParams: array[0..0] of jValue;
jMethod: jMethodID=nil;
jCls: jClass=nil;
newSize0: integer;
jNewArray0: jObject=nil;
i: integer;
label
_exceptionOcurred;
begin
if (env = nil) or (_jdbcoracleconnection = nil) then exit;
jCls:= env^.GetObjectClass(env, _jdbcoracleconnection);
if jCls = nil then goto _exceptionOcurred;
jMethod:= env^.GetMethodID(env, jCls, 'main', '([Ljava/lang/String;)V');
if jMethod = nil then begin env^.DeleteLocalRef(env, jCls); goto _exceptionOcurred; end;
newSize0:= ?; //Length(?);
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(args[i])));
end;
jParams[0].l:= jNewArray0;
env^.CallVoidMethodA(env, _jdbcoracleconnection, jMethod, @jParams);
env^.DeleteLocalRef(env,jParams[0].l);
env^.DeleteLocalRef(env, jCls);
_exceptionOcurred: jni_ExceptionOccurred(env);
end;
end.