From a203538886f7bfae4fb274536cfd035c40b5c46a Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Thu, 16 Jul 2015 08:03:17 -0700 Subject: [PATCH] extracting latitude and longitude #1716 --- android/cpp/jni.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index 81cf6160b..9049c8566 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -525,13 +525,24 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr } for (jsize i = 0; i < len; i++) { - jobject jobj = reinterpret_cast(env->GetObjectArrayElement(array, i)); - if (jobj == nullptr) { + jobject latLng = reinterpret_cast(env->GetObjectArrayElement(array, i)); + if (latLng == nullptr) { env->ExceptionDescribe(); return -1; } - // vector.push_back(std_string_from_jstring(env, jstr)); + jdouble latitude = env->GetDoubleField(latLng, latLngLatitudeId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return -1; + } + latitude++; + jdouble longitude = env->GetDoubleField(latLng, latLngLongitudeId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return -1; + } + longitude++; } return (jlong)width;