From: Tobias Brunner Date: Fri, 30 May 2014 10:35:54 +0000 (+0200) Subject: android: Subclass Application to provide static access to the application context X-Git-Tag: 5.2.1dr1~117^2~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6684195505c8d034cffab60e621921cc77f4bdde;p=thirdparty%2Fstrongswan.git android: Subclass Application to provide static access to the application context --- diff --git a/src/frontends/android/AndroidManifest.xml b/src/frontends/android/AndroidManifest.xml index 721d0c0fe4..e2d25e4acc 100644 --- a/src/frontends/android/AndroidManifest.xml +++ b/src/frontends/android/AndroidManifest.xml @@ -26,6 +26,7 @@ . + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +package org.strongswan.android.logic; + +import android.app.Application; +import android.content.Context; + +public class StrongSwanApplication extends Application +{ + private static Context mContext; + + @Override + public void onCreate() + { + super.onCreate(); + StrongSwanApplication.mContext = getApplicationContext(); + } + + /** + * Returns the current application context + * @return context + */ + public static Context getContext() + { + return StrongSwanApplication.mContext; + } +}