Skip to content
Browse files

jni: add docs for jni vector helper

  • Loading branch information...
1 parent 1835938 commit ef50cda7557b1af34381e86043c1a9b3128a8d5a Cory Fields committed
Showing with 16 additions and 1 deletion.
  1. +16 −1 xbmc/android/jni/README
17 xbmc/android/jni/README
@@ -83,7 +83,22 @@ The fix:
retrun externalDir;
-b. Probably lots more.
+b. Java has an understanding of arrays like Type[] which contain size info.
+ C-style arrays don't carry size information, so passing a c-array as a
+ parameter does not provide enough info to work with it realistically.
+ workaround: Data should be passed in/out of Java arrays as std::vectors of
+ primitive types or jni classes.
+ Care should be taken to avoid making needless copies of objects in the
+ process. To automate this, jcast() can be used to convert a j(h)objectArray
+ directly to a vector of native objects. For example:
+ std::vector<CJNIFoo> example()
+ {
+ return jcast<std::vector<CJNIFoo> >(call_method<jhobjectArray>(object, "function", "()[Lsome/Class;"))
+ }
+c. Probably lots more.
8. Is the entire API implemented?
Not even close! Classes and individual functions have been added as-needed.

0 comments on commit ef50cda

Please sign in to comment.
Something went wrong with that request. Please try again.