public class MyApplication extends Application {

private static Context context;

public void onCreate() {
super.onCreate();
MyApplication.context = getApplicationContext();
}

public static Context getAppContext() {
return MyApplication.context;
}
}
Now everywhere call MyApplication.getAppContext() to get your application context statically.



arrow
arrow
    全站熱搜
    創作者介紹
    創作者 小彬彬 的頭像
    小彬彬

    攝即是空

    小彬彬 發表在 痞客邦 留言(0) 人氣()