我有一个用于管理Activity内部片段的基类。它处理片段backstack,打开等但是在Orientation上更改此对象变为null并且我丢失了所有片段状态。
public class Dashboard extends AbstractNavDrawerActivity implements AsyncRequest
.OnAsyncRequestComplete {
BaseFragmentOrganizer fragmentOrganizer;//object that manages backstack and other operation
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//on orientation change fragmentOrganizer becomes null so no more backstack.
if (savedInstanceState == null) {
fragmentOrganizer = new MainFragmentOrganizer(getSupportFragmentManager());
}
答案 0 :(得分:1)
您只需将android:configChanges="orientation|screenSize"
添加到manifest
文件中的活动。
它不会重新创建您的活动。