如何重载onResume()
以正确的方式工作?我想从 activity
返回到 MainActivity
,我希望在其中具有与应用程序启动后相同的状态。我想使用 recreate()
但它循环了或者类似的情况。
我的代码:
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
recreate();
}
最佳答案
实现onSaveInstanceState(Bundle save)
和onRestoreInstanceState(Bundle Restore)
来保存和恢复状态。请参阅the documentation on this.
关于java - 重载 onResume(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21766703/