[fpc-pascal] JNI/Android: Java events calling pascal code

leledumbo leledumbo_cool at yahoo.co.id
Tue Apr 22 18:26:07 CEST 2014

> Now to the java media player: You assign a pascal method to the 
OnCompetion event (the question is how), and start the player 
(pascal/jni). Once the song is over, OnCompletion will fire and call the 
assigned pascal method. 

Ah... I see. That is AFAIK not possible. Java doesn't have the procedural
type concept as it has much more OOP forced. Common Java code for callback
is to pass an anonymous inner class implementing expected interface. The
problem is that AFAIK JNI doesn't have access to dynamic class creation like
that, you will need to write a Java wrapper which implements the interface
and assign the Pascal callback.

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/JNI-Android-Java-events-calling-pascal-code-tp5718988p5718995.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.

More information about the fpc-pascal mailing list