On 22/04/14 19:26, leledumbo wrote:
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.

So there is no way out without java coding. Moreover, each jclass that has 'events' will need a wrapper class.

However, it seems there might be a better solution which uses a fixed java snippet for all classes (using a dynamic proxy). As I am not very involved with java, pls have a look at:
https://groups.google.com/forum/#!topic/android-ndk/SRgy93Un8vM
especially the post before the last. Maybe you can shed more light on this?

Thanks,
Stephano
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to