[fpc-devel] JVM: class of XYZ => java.lang.Class

Sven Barth pascaldragon at googlemail.com
Sun Dec 25 18:19:08 CET 2011


Hello Jonas!

I'm getting along quite well with implementing my first real Android 
application, but now I've hit a little problem: to start a new activity 
I need to pass the class type as a parameter which is declared as 
"java.lang.Class". If I give my class type as a parameter (which derives 
from one of Android's activity classes) the compiler complains with the 
following error:

TrainLog.lpr(249,53) Error: Incompatible type for arg no. 2: Got "Class 
Of TTrainTypeActivity", expected "JLClass"

What is the best way to solve this? I know that there is a "getClass" 
function declared in JLObject, but that is an instance method and I 
don't have an instance of my new activity yet and also I don't think 
that it is wise to construct an instance of an activity class manually.

Regards,
Sven



More information about the fpc-devel mailing list