From ae9a2d2a72b5e5dbbf5656de3b1f54517ec184fa Mon Sep 17 00:00:00 2001 From: rachytski Date: Mon, 6 Feb 2012 18:57:28 +0400 Subject: [PATCH] [android] re-initializing Platform upon receiving onCreate. --- android/jni/com/mapswithme/maps/MWMActivity.cpp | 8 ++++---- android/jni/com/mapswithme/platform/Platform.cpp | 3 +++ platform/platform_android.cpp | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/android/jni/com/mapswithme/maps/MWMActivity.cpp b/android/jni/com/mapswithme/maps/MWMActivity.cpp index 6dc880b1e2..7a38b89e7c 100644 --- a/android/jni/com/mapswithme/maps/MWMActivity.cpp +++ b/android/jni/com/mapswithme/maps/MWMActivity.cpp @@ -46,10 +46,9 @@ extern "C" jstring storagePath, jstring tmpPath, jstring extTmpPath, - jstring settingsPath) + jstring settingsPath, + jstring emptyModelMessage) { - if (!g_framework) - { android::Platform::Instance().Initialize(env, densityDpi, screenWidth, @@ -60,8 +59,9 @@ extern "C" extTmpPath, settingsPath); + if (!g_framework) g_framework = new android::Framework(g_jvm); - } + g_framework->SetEmptyModelMessage(emptyModelMessage); } //////////////////////////////////////////////////////////////////////////////////////////// diff --git a/android/jni/com/mapswithme/platform/Platform.cpp b/android/jni/com/mapswithme/platform/Platform.cpp index 9e5ea1db42..b4178a978f 100644 --- a/android/jni/com/mapswithme/platform/Platform.cpp +++ b/android/jni/com/mapswithme/platform/Platform.cpp @@ -109,6 +109,9 @@ namespace android jstring extTmpPath, jstring settingsPath) { + if (m_impl) + delete m_impl; + m_impl = new PlatformImpl(densityDpi, screenWidth, screenHeight); m_resourcesDir = jni::ToString(env, apkPath); diff --git a/platform/platform_android.cpp b/platform/platform_android.cpp index d0f09b467e..5b0fa3e31e 100644 --- a/platform/platform_android.cpp +++ b/platform/platform_android.cpp @@ -8,7 +8,7 @@ #include #include -Platform::Platform() +Platform::Platform() : m_impl(0) {} Platform::~Platform()