public class MyApplication extends Application{
private static Context context;
@Override
public void onCreate() {
super.onCreate();
context = getApplicationContext();
}
public static Context getContext(){
return context;
}
}
application
android:name="com.example.euler_kalvinhe.takephoto.MyApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >**
版权声明:本文为博主原创文章,未经博主允许不得转载。
Android-获取全局Context的技巧-android学习之旅(68)
原文地址:http://blog.csdn.net/lpjishu/article/details/47357413