@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); // AdManager.getInstance(this).init("81b5d6a3b8130593", "51f70349743c649d", false); if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { // 结束你的activity this.finish(); return; } hideTitlebar(); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); SharedPreferences sp = getSharedPreferences(GuideActivity.SP_NAME, MODE_PRIVATE); if (sp.getInt(GuideActivity.SP_KEY, 0) == 0) { Intent intent = new Intent(this, GuideActivity.class); startActivity(intent); this.finish(); return; } initView(); SharedPreferences shortcutpref = WeFlowApplication.getAppInstance().getSharedPreferences("shortcut", Context.MODE_PRIVATE); boolean iscreated = shortcutpref.getBoolean("iscreated", false); if (!iscreated) { createDeskShortCut(); } DevOpenHelper helper = new DaoMaster.DevOpenHelper(this, "weflowdb", null); db = helper.getWritableDatabase(); daoMaster = new DaoMaster(db); daoSession = daoMaster.newSession(); accountInfoDao = daoSession.getAccountInfoDao(); aiList = accountInfoDao.loadAll(); if (aiList != null && aiList.size() > 0) { AccountInfo lastAcc = aiList.get(0); if (lastAcc.getUserid() != null && !lastAcc.getUserid().equals("")) { // 存在userid Requester.autoLogin(false, handler, lastAcc.getUserid()); return; } } handler.postDelayed(runnable, INTV_TIME); }
@Override public void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); if (db != null) db.close(); }