代码
public class MyApplication extends Application{
private static Context context;
@override
public coid oncreat(){
context = getApplicationContext();
}
public static Context getContext(){
return context;
}
}
注意
- 在AndroidManifest.xml文件的<application>标签下进行指定