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

2014-06-13 Thread tylercaro
Chriss Kalogeropoulos wrote he main reason is to avoid distributing extra files with the application. Having just one exe or dll that can handle the details is much better. I was also hoping to reuse the code in other similar projects that had different listeners. For example, a barcode

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

2014-04-23 Thread leledumbo
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

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

2014-04-23 Thread Felipe Monteiro de Carvalho
On Wed, Apr 23, 2014 at 6:10 AM, leledumbo leledumbo_c...@yahoo.co.id wrote: Hmm...that's beyond my Java skill. Since Felipe who started the topic, you can try PM him instead. So looking at what he originally posted: setOnCompletionListener(MediaPlayer.OnCompletionListener listener) And

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

2014-04-23 Thread Chriss Kalogeropoulos
Hello everyone, a couple years ago i tried the same thing. The task was to implement a JavaPOS driver handler from Delphi/FPC code. The actual driver was implemented in C++ and it used a Java interface. My code was the glue between the application (Delphi/FPC) and the driver, it had to hook the

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

2014-04-23 Thread patspiper
On 23/04/14 12:31, Felipe Monteiro de Carvalho wrote: On Wed, Apr 23, 2014 at 6:10 AM, leledumboleledumbo_c...@yahoo.co.id wrote: Hmm...that's beyond my Java skill. Since Felipe who started the topic, you can try PM him instead. So looking at what he originally posted:

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

2014-04-23 Thread patspiper
On 23/04/14 13:20, Chriss Kalogeropoulos wrote: Hello everyone, a couple years ago i tried the same thing. The task was to implement a JavaPOS driver handler from Delphi/FPC code. The actual driver was implemented in C++ and it used a Java interface. My code was the glue between the

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

2014-04-23 Thread fredvs
Hello. Hum, if you are not obliged to use Java media-player, you may use = https://github.com/fredvs/uoslib. That fpc audio library is Java-comatible and can do easy callbacks... - Many thanks ;-) -- View this message in context:

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

2014-04-23 Thread Chriss Kalogeropoulos
The main reason is to avoid distributing extra files with the application. Having just one exe or dll that can handle the details is much better. I was also hoping to reuse the code in other similar projects that had different listeners. For example, a barcode reader javapos driver has different

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

2014-04-22 Thread leledumbo
My question is whether it is possible to hook into (as an example) the java media player events without writing java code. As for the opposite direction, calling the media player's Start method from pascal does not need any java code. If it can be done from C, then it can be done from Pascal

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

2014-04-22 Thread patspiper
On 22/04/14 12:02, leledumbo wrote: My question is whether it is possible to hook into (as an example) the java media player events without writing java code. As for the opposite direction, calling the media player's Start method from pascal does not need any java code. If it can be done from

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

2014-04-22 Thread leledumbo
My question is if it can be done without a java wrapper class as this would make android programming much easier (unless I have misunderstood your reply). Perhaps I misunderstood your question in the first place. Could you instead draw a diagram (flowchart?) and emphasize (red circle or

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

2014-04-22 Thread patspiper
On 22/04/14 18:36, leledumbo wrote: My question is if it can be done without a java wrapper class as this would make android programming much easier (unless I have misunderstood your reply). Perhaps I misunderstood your question in the first place. Could you instead draw a diagram (flowchart?)

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

2014-04-22 Thread leledumbo
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

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

2014-04-22 Thread patspiper
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

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

2014-04-21 Thread patspiper
Hi, Is it possible to implement using JNI java events callbacks without writing java code? For example, the android media player defines: setOnCompletionListener(MediaPlayer.OnCompletionListener listener) which registers a callback to be invoked when the end of a media source has been

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

2014-04-21 Thread fredvs
Hello. take a look here : = http://wiki.freepascal.org/Using_Pascal_Libraries_with_Java At = Dealing with callback procedures. - Many thanks ;-) -- View this message in context:

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

2014-04-21 Thread patspiper
On 21/04/14 21:53, fredvs wrote: Hello. take a look here : = http://wiki.freepascal.org/Using_Pascal_Libraries_with_Java At = Dealing with callback procedures. The wiki page describes how to interact bi-directionally between your own java and pascal code. My question is whether it is