@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setDisplayActionbarBack(false); setContentView(R.layout.activity_home_activity2); initView(); }
@Override protected void onResume() { super.onResume(); handler.postDelayed(slideRunnable, SLIDE_SPACE_TIME); registerReceiver(mWifiReceiver, new IntentFilter(WifiWidgetProvider.UPDATE_ACTION)); // 招新,启动扫描WIFI的服务 SharedPreferences pref = MyApplication.getSharedPreferences(); Intent service = new Intent(this, RecruitCheckWifi.class); int state = pref.getInt(Pref.RECRUIT_STATE, 0); if (state != 0 && state != 8) { startService(service); } else { stopService(service); } }
@Override public void onBackPressed() { if (isBackPressedFirst) { super.onBackPressed(); } else { isBackPressedFirst = true; Util.toast("再按一次退出程序", 1400); handler.postDelayed( new Runnable() { @Override public void run() { isBackPressedFirst = false; } }, 1400); } }
@Override public void onPause() { super.onPause(); handler.removeCallbacks(slideRunnable); unregisterReceiver(mWifiReceiver); }