我正在使用滑块菜单,并从片段的其中一个按钮单击调用一个活动,只需在该活动的操作栏中单击保存按钮时关闭活动。当我单击纵向保存按钮时没有出现错误,而当我将我的设备保持在横向模式并单击保存时,会出现以下错误。
注意:片段和活动都限制为纵向模式。请有人建议我解决方案。
在下面的错误中, 主动 - >包含滑块中所有片段的活动。 设置片段 - >它是调用一个活动的片段。 首页 - >它是滑块中的初始主片段,我的意思是一旦调用主要活动就默认片段。
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.symtrac_loc.tr/com.novartis.symtrac.slider.MainActivity}: java.lang.IllegalStateException: Can't change tag of fragment FragmentSettings{433cf7e0 #2 id=0x7f0900fa SETTINGS}: was SETTINGS now HOME
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3924)
at android.app.ActivityThread.access$1000(ActivityThread.java:161)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1271)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5356)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: Can't change tag of fragment FragmentSettings{433cf7e0 #2 id=0x7f0900fa SETTINGS}: was SETTINGS now HOME
at android.support.v4.app.BackStackRecord.doAddOp(BackStackRecord.java:398)
at android.support.v4.app.BackStackRecord.replace(BackStackRecord.java:429)
at com.novartis.symtrac.slider.MainActivity.onCreate(MainActivity.java:134)
at android.app.Activity.performCreate(Activity.java:5426)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3924)
at android.app.ActivityThread.access$1000(ActivityThread.java:161)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1271)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5356)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)