android: Subclass Application to provide static access to the application context
[strongswan.git] / src / frontends / android / src / org / strongswan / android / logic / StrongSwanApplication.java
1 /*
2 * Copyright (C) 2014 Tobias Brunner
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 package org.strongswan.android.logic;
17
18 import android.app.Application;
19 import android.content.Context;
20
21 public class StrongSwanApplication extends Application
22 {
23 private static Context mContext;
24
25 @Override
26 public void onCreate()
27 {
28 super.onCreate();
29 StrongSwanApplication.mContext = getApplicationContext();
30 }
31
32 /**
33 * Returns the current application context
34 * @return context
35 */
36 public static Context getContext()
37 {
38 return StrongSwanApplication.mContext;
39 }
40 }