MCPcopy Create free account
hub / github.com/NativeScript/android / CreateArrayByClassName

Method CreateArrayByClassName

test-app/runtime/src/main/cpp/ArrayHelper.cpp:126–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126jobject ArrayHelper::CreateArrayByClassName(const string& typeName, int length) {
127 JEnv env;
128 jobject array;
129
130 if (typeName == "char") {
131 array = env.NewCharArray(length);
132 } else if (typeName == "boolean") {
133 array = env.NewBooleanArray(length);
134 } else if (typeName == "byte") {
135 array = env.NewByteArray(length);
136 } else if (typeName == "short") {
137 array = env.NewShortArray(length);
138 } else if (typeName == "int") {
139 array = env.NewIntArray(length);
140 } else if (typeName == "long") {
141 array = env.NewLongArray(length);
142 } else if (typeName == "float") {
143 array = env.NewFloatArray(length);
144 } else if (typeName == "double") {
145 array = env.NewDoubleArray(length);
146 } else {
147 JniLocalRef s(env.NewStringUTF(typeName.c_str()));
148 array = env.CallStaticObjectMethod(RUNTIME_CLASS, CREATE_ARRAY_HELPER, (jstring)s, length);
149 }
150
151 return array;
152}
153
154jclass ArrayHelper::RUNTIME_CLASS = nullptr;
155jmethodID ArrayHelper::CREATE_ARRAY_HELPER = nullptr;

Callers

nothing calls this directly

Calls 10

NewCharArrayMethod · 0.80
NewBooleanArrayMethod · 0.80
NewByteArrayMethod · 0.80
NewShortArrayMethod · 0.80
NewIntArrayMethod · 0.80
NewLongArrayMethod · 0.80
NewFloatArrayMethod · 0.80
NewDoubleArrayMethod · 0.80
NewStringUTFMethod · 0.80

Tested by

no test coverage detected