[android] Do not delete framework instance when MWMActivity is destroyed

This commit is contained in:
Alex Zolotarev 2012-01-25 08:23:19 +03:00 committed by Alex Zolotarev
parent f9ecddcb56
commit c74a4c2995
2 changed files with 10 additions and 22 deletions

View file

@ -18,14 +18,10 @@ Java_com_mapswithme_maps_MWMActivity_nativeInit(JNIEnv * env, jobject thiz, int
jni::GetString(env, apkPath), jni::GetString(env, storagePath),
jni::GetString(env, tmpPath), jni::GetString(env, extTmpPath),
jni::GetString(env, settingsPath));
g_framework = new android::Framework();
}
JNIEXPORT void JNICALL
Java_com_mapswithme_maps_MWMActivity_nativeDestroy(JNIEnv * env, jobject thiz)
{
delete g_framework;
g_framework = 0;
// @TODO framework is never deleted, it's needed for download activity too
if (!g_framework)
g_framework = new android::Framework();
}
////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -159,14 +159,14 @@ public class MWMActivity extends SmartGLActivity implements
// Get screen density
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
nativeInit(metrics.densityDpi,
nativeInit(metrics.densityDpi,
metrics.widthPixels,
metrics.heightPixels,
getAppBundlePath(),
extStoragePath,
getTmpPath(),
extTmpPath,
getAppBundlePath(),
extStoragePath,
getTmpPath(),
extTmpPath,
getSettingsPath());
checkMeasurementSystem();
@ -174,13 +174,6 @@ public class MWMActivity extends SmartGLActivity implements
m_locationService = new LocationService(this);
}
@Override
public void onDestroy()
{
nativeDestroy();
super.onDestroy();
}
// From Location interface
public void onLocationStatusChanged(int newStatus)
{
@ -240,7 +233,7 @@ public class MWMActivity extends SmartGLActivity implements
case R.id.menuitem_about_dialog:
onAboutDialogClicked();
return true;
default:
return super.onOptionsItemSelected(item);
}
@ -368,7 +361,6 @@ public class MWMActivity extends SmartGLActivity implements
private native void nativeInit(int densityDpi, int screenWidth, int screenHeight,
String apkPath,
String storagePath, String tmpPath, String extTmpPath, String settingsPath);
private native void nativeDestroy();
private native void nativeLocationStatusChanged(int newStatus);
private native void nativeLocationUpdated(long time, double lat, double lon, float accuracy);
private native void nativeCompassUpdated(long time, double magneticNorth, double trueNorth, float accuracy);