从方向更改后,从Fragment创建的DialogFragment崩溃了

时间:2014-10-19 13:44:22

标签: android onactivityresult dialogfragment

问题是,在方向改变后,DialogFragment目标不在片段管理器中;所以重写onDestroyView()并将setRetainInstance(true)设置为Dialogfragment并没有解决它!!

来自MyFragment.java的代码

public class MyFragment extends ListFragment {
    //...
    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode != Activity.RESULT_OK)
            return;
        if (requestCode == REQUEST_TO_DIALOG_FRAGMENT) {
            //...
        }
    }

    private void show_my_dialog_fragment(int index) { 
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.addToBackStack(null);

        DialogFragment fragment = MyDialogFragment.newInstance(index);
        fragment.setTargetFragment(this, REQUEST_TO_DIALOG_FRAGMENT);
        fragment.show(ft, null);
    }
}

这来自MyDialogFragment.java

MyDialogFragment extends DialogFragment {
    //...
    private void sendResult(int resultCode) {
        if (getTargetFragment() == null)
            return;
        getTargetFragment().onActivityResult(getTargetRequestCode(), resultCode, null);
    }
}

https://github.com/imla-assuom/DrawerDialogFragment.git

示例应用的LogCat:

 10-20 07:34:26.016    4931-4931/com.example.imla.drawerdialogefragment I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:320>: EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbDate: 11/06/13
10-20 07:34:26.046    4931-4931/com.example.imla.drawerdialogefragment D/OpenGLRenderer﹕ Enabling debug mode 0
10-20 07:34:36.776    4931-4931/com.example.imla.drawerdialogefragment W/View﹕ requestLayout() improperly called by android.widget.ListView{64e905e8 IFED.VC. ......ID -480,0-0,942 #7f080002 app:id/navigation_drawer} during layout: running second layout pass
10-20 07:34:36.776    4931-4931/com.example.imla.drawerdialogefragment I/MyFragment﹕ onActivityResult
10-20 07:34:41.060    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ Failure saving state: MyDialogFragment{64e88348 #2} has target not in fragment manager: MyFragment{64e881b0}
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ Activity state:
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ Local Activity 64e87320 State:
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mResumed=false mStopped=false mFinished=false
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mLoadersStarted=true
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mChangingConfigurations=true
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mCurrentConfig={1.0 ?mcc?mnc en_US ldltr sw600dp w960dp h527dp 320dpi lrg land finger -keyb/v/h -nav/h s.24}
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ Active Fragments in 64e87420:
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ #0: NavigationDrawerFragment{64e87ff8 #0 id=0x7f080002}
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mFragmentId=#7f080002 mContainerId=#7f080000 mTag=null
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mState=4 mIndex=0 mWho=android:fragment:0 mBackStackNesting=0
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mAdded=true mRemoving=false mResumed=false mFromLayout=true mInLayout=true
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mHidden=false mDetached=false mMenuVisible=true mHasMenu=true
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mRetainInstance=false mRetaining=false mUserVisibleHint=true
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mFragmentManager=FragmentManager{64e87420 in MainActivity{64e87320}}
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mActivity=com.example.imla.drawerdialogefragment.MainActivity@64e87320
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mSavedViewState={2131230722=AbsListView.SavedState{64ea3fe8 selectedId=-9223372036854775808 firstId=-1 viewTop=0 position=0 height=942 filter=null checkState={0=true}}}
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ [ 10-20 07:34:41.070  4931: 4931 E/FragmentManager ]
    mView=android.widget.ListView{64e905e8 IFED.VC. ......ID -480,0-0,942 #7f080002 app:id/navigation_drawer}
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ #1: MyFragment{64e90310 #1 id=0x7f080001}
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mFragmentId=#7f080001 mContainerId=#7f080001 mTag=null
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mState=4 mIndex=1 mWho=android:fragment:1 mBackStackNesting=0
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mAdded=true mRemoving=false mResumed=false mFromLayout=false mInLayout=false
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mHidden=false mDetached=false mMenuVisible=true mHasMenu=false
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mRetainInstance=false mRetaining=false mUserVisibleHint=true
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mFragmentManager=FragmentManager{64e87420 in MainActivity{64e87320}}
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mActivity=com.example.imla.drawerdialogefragment.MainActivity@64e87320
10-20 07:34:41.070    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mSavedViewState={2131230723=android.view.AbsSavedState$1@60aa32c0}
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mContainer=android.widget.FrameLayout{64e8fd40 V.E..... ........ 0,0-1920,942 #7f080001 app:id/container}
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mView=android.widget.RelativeLayout{64e97300 V.E..... ........ 0,0-1920,942}
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ #2: MyDialogFragment{64e88348 #2}
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mFragmentId=#0 mContainerId=#0 mTag=null
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mState=4
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mIndex=2 mWho=android:fragment:2 mBackStackNesting=1
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mAdded=true mRemoving=false mResumed=false mFromLayout=false mInLayout=false
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mHidden=false mDetached=false mMenuVisible=true mHasMenu=false
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mRetainInstance=false mRetaining=false mUserVisibleHint=true
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mFragmentManager=FragmentManager{64e87420 in MainActivity{64e87320}}
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mActivity=com.example.imla.drawerdialogefragment.MainActivity@64e87320
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mArguments=Bundle[{INDEX=2}]
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mSavedViewState={2131230723=android.view.AbsSavedState$1@60aa32c0}
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mTarget=MyFragment{64e881b0} mTargetRequestCode=1
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mView=android.widget.RelativeLayout{64e931b0 V.E..... ......I. 0,0-1128,1022}
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ DialogFragment:
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mStyle=1 mTheme=0x0
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mCancelable=true mShowsDialog=true mBackStackId=0
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mDialog=android.app.Dialog@64e92dc0
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mViewDestroyed=false mDismissed=false mShownByMe=false
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ Added Fragments:
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ #0: NavigationDrawerFragment{64e87ff8 #0 id=0x7f080002}
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ #1: MyDialogFragment{64e88348 #2}
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ #2:
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ MyFragment{64e90310 #1 id=0x7f080001}
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ Fragments Created Menus:
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ #0: NavigationDrawerFragment{64e87ff8 #0 id=0x7f080002}
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ Back Stack:
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ #0: BackStackEntry{64e88530 #0}
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mName=null mIndex=0 mCommitted=false
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ Operations:
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ Op #0: ADD MyDialogFragment{64e88348 #2}
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ Back Stack Indices:
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ #0: BackStackEntry{64e88530 #0}
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ FragmentManager misc state:
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mActivity=com.example.imla.drawerdialogefragment.MainActivity@64e87320
10-20 07:34:41.080    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mContainer=android.app.Activity$1@64e87498
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mCurState=4 mStateSaved=true mDestroyed=false
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ ViewRoot:
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mAdded=true mRemoved=false
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mConsumeBatchedInputScheduled=false
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mPendingInputEventCount=0
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mProcessInputEventsScheduled=false
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mTraversalScheduled=false
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.view.ViewRootImpl$NativePreImeInputStage: mQueueLength=0
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.view.ViewRootImpl$ImeInputStage: mQueueLength=0
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.view.ViewRootImpl$NativePostImeInputStage: mQueueLength=0
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ Choreographer:
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mFrameScheduled=false
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ mLastFrameTime=3330181 (4246 ms ago)
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ [ 10-20 07:34:41.090  4931: 4931 E/FragmentManager ]
    View Hierarchy:
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ com.android.internal.policy.impl.PhoneWindow$DecorView{64e88610 V.E..... R....... 0,0-1920,1104}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ com.android.internal.widget.ActionBarOverlayLayout{64e88c48 V.ED.... ........ 0,0-1920,1104 #1020313 android:id/action_bar_overlay_layout}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.widget.FrameLayout{64e89838 V.E..... ........ 0,162-1920,1104 #1020002 android:id/content}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.support.v4.widget.DrawerLayout{64e8f5c8 VFE..... .F...... 0,0-1920,942 #7f080000 app:id/drawer_layout}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.widget.FrameLayout{64e8fd40 V.E..... ........ 0,0-1920,942 #7f080001 app:id/container}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.widget.RelativeLayout{64e97300 V.E..... ........ 0,0-1920,942}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.widget.TextView{64e97748 V.ED..C. ........ 128,32-1792,910 #7f080003 app:id/section_label}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.widget.ListView{64e905e8 IFED.VC. ......ID -480,0-0,942 #7f080002 app:id/navigation_drawer}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.widget.TextView{64e9c120 V.ED.... .....AI. 0,0-480,96 #1020014 android:id/text1}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.widget.TextView{64e9cc08 V.ED.... ......I. 0,95-480,191 #1020014 android:id/text1}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.widget.TextView{64e9d598 V.ED.... ......I. 0,190-480,286 #1020014 android:id/text1}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ com.android.internal.widget.ActionBarContainer{64e89c30 V.ED.... ........ 0,50-1920,162 #1020314 android:id/action_bar_container}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ com.android.internal.widget.ActionBarView{64e8a130 V.E..... ........ 0,0-1920,112 #1020315 android:id/action_bar}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.widget.LinearLayout{64e8a690 VFE...C. ........ 0,0-538,112}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ com.android.internal.widget.ActionBarView$HomeView{64e8b748 V.E..... ........ 0,0-129,112}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.widget.ImageView{64e8bad8 V.ED.... ........ 0,40-32,72 #102025a android:id/up}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.widget.ImageView{64e8be38 V.ED.... ........ 25,8-121,104 #102002c android:id/home}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.widget.LinearLayout{64e8d010 V.E..... ........ 129,31-538,80}
10-20 07:34:41.090    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ [ 10-20 07:34:41.100  4931: 4931 E/FragmentManager ]
    android.widget.TextView{64e8d318 V.ED.... ........ 0,0-393,49 #1020265 android:id/action_bar_title}
10-20 07:34:41.100    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ android.widget.TextView{64e8df98 G.ED.... ......I. 0,0-0,0 #1020266 android:id/action_bar_subtitle}
10-20 07:34:41.100    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ com.android.internal.view.menu.ActionMenuView{64e9fbd0 V.ED.... ........ 1558,0-1920,112}
10-20 07:34:41.100    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ com.android.internal.view.menu.ActionMenuItemView{64ea1430 VFED..CL ........ 0,0-232,112 #7f080005 app:id/action_example}
10-20 07:34:41.100    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ com.android.internal.view.menu.ActionMenuPresenter$OverflowMenuButton{64e9ef30 VFED..C. ........ 234,0-362,112}
10-20 07:34:41.100    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ com.android.internal.widget.ActionBarContextView{64e8e5b0 G.E..... ......ID 0,0-0,0 #1020316 android:id/action_context_bar}
10-20 07:34:41.100    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ com.android.internal.widget.ActionBarContainer{64e8ea78 G.ED.... ......ID 0,0-0,0 #1020317 android:id/split_action_bar}
10-20 07:34:41.100    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ Looper (main, tid 1) {64dfdf40}
10-20 07:34:41.100    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ Message 0: { when=-32ms what=90 target=com.android.internal.view.IInputConnectionWrapper$MyHandler }
10-20 07:34:41.100    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ Message 1: { when=-32ms what=65 target=com.android.internal.view.IInputConnectionWrapper$MyHandler }
10-20 07:34:41.100    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ Message 2: { when=-32ms what=95 target=com.android.internal.view.IInputConnectionWrapper$MyHandler }
10-20 07:34:41.100    4931-4931/com.example.imla.drawerdialogefragment E/FragmentManager﹕ (Total messages: 3, idling=false, quitting=false)
10-20 07:34:41.100    4931-4931/com.example.imla.drawerdialogefragment D/AndroidRuntime﹕ Shutting down VM
10-20 07:34:41.100    4931-4931/com.example.imla.drawerdialogefragment E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.example.imla.drawerdialogefragment, PID: 4931
    java.lang.IllegalStateException: Failure saving state: MyDialogFragment{64e88348 #2} has target not in fragment manager: MyFragment{64e881b0}
            at android.app.FragmentManagerImpl.saveAllState(FragmentManager.java:1651)
            at android.app.Activity.onSaveInstanceState(Activity.java:1205)
            at android.app.Activity.performSaveInstanceState(Activity.java:1153)
            at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1223)
            at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3698)
            at android.app.ActivityThread.access$900(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5001)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
10-20 07:34:44.083    4931-4931/com.example.imla.drawerdialogefragment I/Process﹕ Sending signal. PID: 4931 SIG: 9

1 个答案:

答案 0 :(得分:0)

这取决于您使用的Android版本。在较低版本中没有childfragment manager。要解决这个问题,您可以在主片段的onpause()(在oriantion更改之前调用)中删除此对话框,并在onresume()中替换它(称为postoriantion已更改)