aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-04-09 04:13:26 +0200
committerSven Gothel <[email protected]>2012-04-09 04:13:26 +0200
commitae3756ff570f2c274fca005c50028101aef176e9 (patch)
tree3dd28aec267eb7a3e3dbcc79dd169f8768aa79d1 /src/java/jogamp
parent6b5332374ff238b09d44858873d600e4290302f6 (diff)
ActivityLauncher/LauncherUtil: Clear properties 'onDestroy()'
Diffstat (limited to 'src/java/jogamp')
-rw-r--r--src/java/jogamp/android/launcher/ActivityLauncher.java9
-rw-r--r--src/java/jogamp/android/launcher/LauncherUtil.java13
-rw-r--r--src/java/jogamp/common/os/android/StaticContext.java19
3 files changed, 29 insertions, 12 deletions
diff --git a/src/java/jogamp/android/launcher/ActivityLauncher.java b/src/java/jogamp/android/launcher/ActivityLauncher.java
index 7e2d86d..3dc776d 100644
--- a/src/java/jogamp/android/launcher/ActivityLauncher.java
+++ b/src/java/jogamp/android/launcher/ActivityLauncher.java
@@ -38,12 +38,13 @@ import android.widget.TextView;
import android.util.Log;
public class ActivityLauncher extends Activity {
- static final String TAG = "NEWTLauncherActivity";
+ static final String TAG = "JogAmp-ActivityLauncher";
TextView tv = null;
Method mOnCreate, mOnDestroy, mOnPause, mOnRestart, mOnResume,
mOnStart, mOnStop, mSetRootActivity;
Class<?> activityClazz = null;
Object activityObject = null;
+ LauncherUtil.DataSet data = null;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -51,7 +52,7 @@ public class ActivityLauncher extends Activity {
super.onCreate(savedInstanceState);
final Uri uri = getIntent().getData();
- final LauncherUtil.DataSet data = LauncherUtil.DataSet.create(uri);
+ data = LauncherUtil.DataSet.create(uri);
data.setSystemProperties();
ClassLoader cl = ClassLoaderUtil.createClassLoader(this, data.getPackages(), false);
@@ -133,6 +134,10 @@ public class ActivityLauncher extends Activity {
public void onDestroy() {
Log.d(TAG, "onDestroy - S");
callMethod(activityObject, mOnDestroy);
+ if(null != data) {
+ data.clearSystemProperties();
+ data = null;
+ }
super.onDestroy();
finish();
Log.d(TAG, "onDestroy - X");
diff --git a/src/java/jogamp/android/launcher/LauncherUtil.java b/src/java/jogamp/android/launcher/LauncherUtil.java
index 63452b7..953a810 100644
--- a/src/java/jogamp/android/launcher/LauncherUtil.java
+++ b/src/java/jogamp/android/launcher/LauncherUtil.java
@@ -146,8 +146,14 @@ public class LauncherUtil {
public final void setSystemProperties() {
Iterator<String> argKeys = keyList.iterator();
while(argKeys.hasNext()) {
- final String key = argKeys.next();
- System.setProperty(key, map.get(key));
+ final String key = argKeys.next();
+ System.setProperty(key, map.get(key));
+ }
+ }
+ public final void clearSystemProperties() {
+ Iterator<String> argKeys = keyList.iterator();
+ while(argKeys.hasNext()) {
+ System.clearProperty(argKeys.next());
}
}
@@ -190,6 +196,9 @@ public class LauncherUtil {
public final void setSystemProperties() {
properties.setSystemProperties();
}
+ public final void clearSystemProperties() {
+ properties.clearSystemProperties();
+ }
public final String getProperty(String key) { return properties.getProperty(key); }
public final OrderedProperties getProperties() { return properties; }
public final List<String> getPropertyKeys() { return properties.getPropertyKeys(); }
diff --git a/src/java/jogamp/common/os/android/StaticContext.java b/src/java/jogamp/common/os/android/StaticContext.java
index cb55e65..055fa2f 100644
--- a/src/java/jogamp/common/os/android/StaticContext.java
+++ b/src/java/jogamp/common/os/android/StaticContext.java
@@ -27,26 +27,29 @@
*/
package jogamp.common.os.android;
-import android.content.*;
+import android.content.Context;
import android.util.Log;
public class StaticContext {
- private static Context context = null;
+ private static Context appContext = null;
private static boolean DEBUG = false;
- public static final synchronized void init(Context ctx) {
- if(null != context) {
+ /**
+ * @param appContext mandatory application Context
+ */
+ public static final synchronized void init(Context appContext) {
+ if(null != StaticContext.appContext) {
throw new RuntimeException("Context already set");
}
- if(DEBUG) { Log.d(MD.TAG, "init("+ctx+")"); }
- context = ctx;
+ if(DEBUG) { Log.d(MD.TAG, "init(appCtx "+appContext+")"); }
+ StaticContext.appContext = appContext;
}
public static final synchronized void clear() {
if(DEBUG) { Log.d(MD.TAG, "clear()"); }
- context = null;
+ appContext = null;
}
public static final synchronized Context getContext() {
- return context;
+ return appContext;
}
}