public class MApp extends Application{ private static Context context; private static Handler handler; private static int mainId; public static boolean isLoginSuccess;//是否已经登录的状态 public static MApp mInstance; @Override public void onCreate() { super.onCreate(); mInstance = this; //初始化imageLoader框架 ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).build();//开始构建 ImageLoader.getInstance().init(config); ZXingLibrary.initDisplayOpinion(this); context = getApplicationContext(); //初始化handler handler = new Handler(); //主线程的id mainId = Process.myTid(); } public static MApp getInstance(){ return mInstance; } /** * 对外提供了context * @return */ public static Context getAppContext() { return context; } /** * 得到全局的handler * @return */ public static Handler getAppHanler() { return handler; } /** * 获取主线程id * @return */ public static int getMainThreadId() { return mainId; } }
app
最新推荐文章于 2018-04-06 19:23:48 发布