[android] Put function inverses next to each other
This commit is contained in:
@@ -19,6 +19,21 @@ std::vector<std::string> toVector(JNIEnv& env, jni::Array<jni::String> array) {
|
||||
return vector;
|
||||
}
|
||||
|
||||
jni::Array<jni::String> toArray(JNIEnv& env, const std::vector<std::string>& vector) {
|
||||
static auto clazz = *jni::Class<jni::StringTag>::Find(env).NewGlobalRef(env).release();
|
||||
auto result = jni::Array<jni::String>::New(env, vector.size(), clazz);
|
||||
|
||||
std::size_t index = 0;
|
||||
for (auto&& item : vector) {
|
||||
auto element = jni::Make<jni::String>(env, item);
|
||||
result.Set(env, index, element);
|
||||
DeleteLocalRef(env, element);
|
||||
index++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user