Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2012-05-18 13:01:43 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:38:34 +0300
commit8a9e9b803e2f619262927f75c75508c0ff254599 (patch)
treef4c3bbe53cbb65953f6f4a12bd252735b594e26d /android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp
parent325fff401ef5eb2bc8e8404a6d15f51329f20dd7 (diff)
[android] Fix bug with native nested Java object creation (simply avoid this).
Diffstat (limited to 'android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp')
-rw-r--r--android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp b/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp
index e9001646da..e9accdcc1c 100644
--- a/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp
+++ b/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp
@@ -165,21 +165,14 @@ extern "C"
JNIEnv * env = jni::GetEnv();
- jmethodID onFinishMethod = env->GetMethodID(env->GetObjectClass(*obj.get()), "onDownloadFinished", "(I)V");
- ASSERT(onFinishMethod, ("Not existing method: void onDownloadFinished(int)"));
-
- env->CallVoidMethod(*obj.get(), onFinishMethod, errorCode);
+ jmethodID methodID = jni::GetJavaMethodID(env, *obj.get(), "onDownloadFinished", "(I)V");
+ env->CallVoidMethod(*obj.get(), methodID, errorCode);
}
void DownloadFileProgress(shared_ptr<jobject> obj, downloader::HttpRequest & req)
{
LOG(LDEBUG, (req.Progress().first, "bytes for", g_filesToDownload.back().m_fileName, "was downloaded"));
- JNIEnv * env = jni::GetEnv();
-
- jmethodID onProgressMethod = env->GetMethodID(env->GetObjectClass(*obj.get()), "onDownloadProgress", "(IIII)V");
- ASSERT(onProgressMethod, ("Not existing method: void onDownloadProgress(int, int, int, int)"));
-
FileToDownload & curFile = g_filesToDownload.back();
jint curTotal = req.Progress().second;
@@ -187,7 +180,10 @@ extern "C"
jint glbTotal = g_totalBytesToDownload;
jint glbProgress = g_totalDownloadedBytes + req.Progress().first;
- env->CallVoidMethod(*obj.get(), onProgressMethod,
+ JNIEnv * env = jni::GetEnv();
+
+ jmethodID methodID = jni::GetJavaMethodID(env, *obj.get(), "onDownloadProgress", "(IIII)V");
+ env->CallVoidMethod(*obj.get(), methodID,
curTotal, curProgress,
glbTotal, glbProgress);
}