x


AndroidJNI array return

I'm fiddling around with the AndroidJNI-Bridge between Unity and Java. So far, everything is fine (I'm no Java user, so some things to learn on this side), I can call functions and everything. But now I'm stuck with arrays. AndroidJavaObject provides a generic .Call<>-method, but Unity simply crashes or returns nothing when trying to use that with an array. So I tried the following, but it also crashes and I have no idea why:

ao = new AndroidJavaObject("org/experiments/arrayTest/ArrayReturner");
IntPtr methodID = AndroidJNI.GetMethodID(ao.GetRawClass(), "arrayMethod", "()[F");
IntPtr floatArray = AndroidJNI.CallObjectMethod(ao.GetRawObject(), methodID, null);
float[] f = AndroidJNI.FromFloatArray(floatArray);

Using ao.Call with another method works fine. Thanks for any help!

more ▼

asked Aug 10 '11 at 01:40 PM

felix. gravatar image

felix.
2k 18 25 47

I can't seem to call any function with it crashing. It's sad that apparently no one here knows anything about JNI and if they do they don't share it...

Aug 13 '11 at 04:10 PM Joshua Falkner
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5274
x2612
x302
x4

asked: Aug 10 '11 at 01:40 PM

Seen: 1309 times

Last Updated: Aug 13 '11 at 04:10 PM