Delphi + android java class + init function


following my previous question (Why I receive Invoke error: method not found), I found a problem and want to make it as a new standalone question

I have this class in java:

public class myClass {

public static void init(String key, Context context) {}


and in Delphi I have:

JMyClassClass = interface(JObjectClass)
{class} procedure init(key: JString; context: JContext); cdecl;

JMyClass = interface(JObject)
TJMyClass = class(TJavaGenericImport<JMyClassClass, JMyClass>) end;

then when i will do in delphi

TJMyClass .JavaClass.init(StringToJstring(‘toto’), TAndroidHelper.Context.getApplicationContext);

i will receive

Invoke error: method not found

if i rename init to anything else (like initialize for exemple) then it’s will work ! but as it’s not my library i can not rename the function

so how can i call the init function from delphi ?

Comments are closed.