P
P
Pavel K2016-03-20 17:28:07
Java
Pavel K, 2016-03-20 17:28:07

Qt (C++) Android JNI how to call a function and get jbytearray?

Greetings!
There is a JAVA function, for example:

public byte[] read()
{
   byte[] data = new byte[100];
   Log.i("FFFF", "READ");
....         
}

I would like to call it and get the result, I do this:
QAndroidJniObject readData = myActivity.callObjectMethod("read", "(V)[B");
 if (!readData.isValid()) return;
 jbyteArray buf =readData.object<jbyteArray>();

But the function is not called and there are no errors. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Perelygin, 2016-03-22
@PavelK

QAndroidJniObject readData = myActivity.callObjectMethod("read", "()[B"); - in my opinion, with an empty parameter list, you should not specify void. Read here: journals.ecs.soton.ac.uk/java/tutorial/native1.1/i...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question