Saving Fragment State on Orientation Change

后端 未结 3 1859
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-31 20:22

I\'m creating a file manager app for Android, and two classes below are the majority of the logic that goes into doing that. What I\'m doing is that on startup of the Conten

3条回答
  •  Happy的楠姐
    2020-12-31 20:56

    this worked for me

    @Override
        protected void onRestoreInstanceState(Bundle savedInstanceState) {
            super.onRestoreInstanceState(savedInstanceState);
            onCreate(savedInstanceState);
        }
    

    and in manifest file inside your Activity tag

    android:configChanges="orientation|screenSize"

提交回复
热议问题