summaryrefslogtreecommitdiffstats
path: root/src/java/jogamp/common/os/android/StaticContext.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-06-04 04:36:52 +0200
committerSven Gothel <[email protected]>2012-06-04 04:36:52 +0200
commitb3c9951006f9bd863244f1db3d54ac7866d66f0a (patch)
treee912f13991c3db98dacd48faadeb9ef9afa65a40 /src/java/jogamp/common/os/android/StaticContext.java
parent4074b34c5edbd11d3ab3fe32678de77816a0a16b (diff)
Fix Bug 583: Remove Android compile-time dependencies and exclude Android specific classes for non Android platforms.
Android specifics are delegated via class AndroidUtils, which uses reflection to call AndroidUtilsImpl if platform is Android. Android code is confined to the packages: jogamp.common.os.android.* jogamp.android.launcher.* and only included when compiled for the Android platform.
Diffstat (limited to 'src/java/jogamp/common/os/android/StaticContext.java')
-rw-r--r--src/java/jogamp/common/os/android/StaticContext.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/java/jogamp/common/os/android/StaticContext.java b/src/java/jogamp/common/os/android/StaticContext.java
index 055fa2f..d7f134a 100644
--- a/src/java/jogamp/common/os/android/StaticContext.java
+++ b/src/java/jogamp/common/os/android/StaticContext.java
@@ -36,7 +36,10 @@ public class StaticContext {
private static boolean DEBUG = false;
/**
+ * Register Android application context for static usage.
+ *
* @param appContext mandatory application Context
+ * @throws RuntimeException if the context is already registered.
*/
public static final synchronized void init(Context appContext) {
if(null != StaticContext.appContext) {
@@ -45,10 +48,19 @@ public class StaticContext {
if(DEBUG) { Log.d(MD.TAG, "init(appCtx "+appContext+")"); }
StaticContext.appContext = appContext;
}
+
+ /**
+ * Unregister the Android application Context
+ */
public static final synchronized void clear() {
if(DEBUG) { Log.d(MD.TAG, "clear()"); }
appContext = null;
}
+
+ /**
+ * Return the registered Android application Context
+ * @return
+ */
public static final synchronized Context getContext() {
return appContext;
}