美文网首页
Android 移除fragment 标记

Android 移除fragment 标记

作者: yunhen | 来源:发表于2019-03-29 18:00 被阅读0次
    @Override
        protected void onCreate(@Nullable Bundle savedInstanceState) {
           
            /**
             * fragmentActivity 被回收时,里面保存的fragment不会销毁,会存到savedInstanceState中
             * 所以在创建时清除所保存的
             */
            if(savedInstanceState != null) {
                String FRAGMENTS_TAG = "android:support:fragments";
                savedInstanceState.remove(FRAGMENTS_TAG);
            }
            super.onCreate(savedInstanceState);
    
    
        
        }
    

    相关文章

      网友评论

          本文标题:Android 移除fragment 标记

          本文链接:https://www.haomeiwen.com/subject/ixsrbqtx.html