@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; } }
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putSerializable("company", Company.getInstance()); }