Example #1
0
 @Override
 public void onBackPressed() {
   long curTime = System.currentTimeMillis();
   if (curTime - lastTime < 1500) {
     super.onBackPressed();
     FileUtil.saveFile(ContextUtil.getContext(), FileUtil.FILE_COMPANY, Company.getInstance());
   } else {
     ContextUtil.toast("再按一次退出!");
     lastTime = curTime;
   }
 }
Example #2
0
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putSerializable("company", Company.getInstance());
 }
Example #3
0
 @Override
 protected void onRestoreInstanceState(Bundle savedInstanceState) {
   super.onRestoreInstanceState(savedInstanceState);
   Company.loadInstance((Company) savedInstanceState.getSerializable("company"));
   sendBroadcast(new Intent(LoginManager.ACTION_INVALIDATE));
 }