我正在尝试调用 onResume,以便我可以在返回后从另一个 fragment 更改变量后重新加载变量。
@Override
public void onResume(){
check1=(CheckBox)getActivity().findViewById(R.id.CheckBox01);
}
上面附有我的 onResume() 代码。 CheckBox01 在另一个 fragment 中。但是,在运行时我收到错误并且应用程序退出。
它在提示
Unable to resume Activity: android.app.supernotcalledException: Fragment Tabmodes did not call through to super.Resume()
我的错误在哪里?
最佳答案
当您重写 onResume()
时,您必须调用 super 方法,正如错误(神秘地)指出的那样:
@Override
public void onResume(){
super.onResume();
check1=(CheckBox)getActivity().findViewById(R.id.CheckBox01);
}
关于java - android 运行时错误 onResume(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13058931/