Hi, I am trying to run the native c++ code under android using NDK and JNI but I think this reffers to a JNI problem in general.
I guess I will start with explaining the functionality of my c++ code and then ask how can I transfer this to JAVA
In my c++ code I do more less sth like the following (i don't want to go too specific into details):
So after all operations I have a float array named 'result' which has the size of 'size1'
Now my question Is how to transport this functionality to Android using NDK. MY ideas are:
1. Because I can't make the cppObject in Java application and it must 'remember' the results of each loop iteration I guess the only solution is to declare cppObject as a global in the JNI .cpp file - is this the right approach and how to do this?
2. I am not sure but I guess I have finally discovered how to pass an array of floats from JAVA to C++. Is this correct?
3. How to create a proper JNI function for this part:
So after I run the native method in Java I will have the same array as 'results' with size of 'size1'. So in other word
- how to return the float * form c++ to JAVA app through JNI
I am spending hours after hours looking for a solution in the Internet so please can somebody help me?