Android No View Found for Fragment after Orientation Change -
When I change my device orientation, I am getting an error. Until the orientation change, everything is well fixed.
I have a piece (trap check Container fragment) which has a frame layout that is used to do any other fragment (trap check fragment). TrapCheckFragment TrapCheckContainerFragment is created in the onCreateView method and is placed in the FrameLayout using a FragmentTransaction.
@Override public view onCreateView (LayoutInflater inflater, ViewGroup container, bundle savedInstanceState) {See rootView = inflater .inflate (R.layout.fragment_trap_check_container, container, false); TrapCheckFragment fragment = new TrapCheckFragment (); Change Fragment (R.id.trapCheckHolder, fragment, false, feature.trapUniqueID.toString ()); Return root view; } Private Vain Reclaimfraugment (Int idtoyrepele, fragment nefragment, boolean adatocak, string tag) {Fragment Transaction Transaction = Fategradation Manager (). BeginTransaction (); Transaction.replace (idToReplace, newFragment, tags); If (adblock stacks) {transaction.addToBackStack (null); } Transaction.commit (); }
As long as I rotate the device, it all works well. None of my codes are called, but I can tell that for some reason the Fragment Manager is not able to find a scene called Network Check Holder which is a framelap to capture the child's fragment. If I remove the phone for replacement, then everything works fine after rotating the device.
Login message:
Fatal exception: main process: com.redacted.appname, PID: 29,396 java.lang.RuntimeException: java.lang.IllegalArgumentException :: no view ID found 0x7f0a0042 (com.redacted.appname activity Unable to start ComponentInfo {com.redacted.appname / com.redacted.appname.activities.MainActivity}: Id / trapCheckHolder) Android to trap Chekfragment {64fa6b18 # 4 ID = 0x7f0a0042 10236} Android. App ActiveTrade.Perform Launching Activity (ActivityTrad.Java1818) Android. App Aktivetivtredawndl launch Aktiveti (Gtividhitredkjawa 2233) android.app.ActivityThread $ H. on android.os on app.ActivityThread.handleRelaunchActivity (ActivityThread.java:3724) android.app.ActivityThread.access $ 900 (ActivityThread.java:135) On handleMessage (ActivityThread.java:1202) Handler dispatchmail (handler.javaauty2) android.os Looper Loop (Loop r.java:136) android.app.ActivityThread.main (ActivityThread.java:5001) java.lang.reflect.Method.invoke (Native Method com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run ) (at java.lang.IllegalArgumentException: com.android.internal.os.ZygoteInit.main (ZygoteInit.java:601) got a visual ID 0x7f0a0042 (com.redacted.appname due to ZygoteInit.java:785) : ID / trapCheckHolder) Trap CheckFragment for Android {64fa6b18 # 4 ID = 0x7f0a0042 10236} and Android.F. FragmentManagerAmple.movatostat (Fragment Manager. Java: 882) Android.F. FragmentManagerIMPLMOVO Test (Fragment Manager. Java 1062) Android. App Backstack Records Off android.app.FragmentManagerImpl.execPendingActions (BackStackRecord.java:684) (FragmentManager.java:1447) android.app.Activity.performStart (Activity.java:5240) on android.app.ActivityThread.performLaunchActivity (ActivityThread.java : 2157) ... 10 more
I have tried to set both the set intentions right and wrong for this and the parent's piece but it has not made any difference. What am I doing here, is it obviously wrong? And is there no way to try to show the old to force a new Trap-Checkfrugment, which causes this problem?
I can provide more information about any code or error.
It seems that onCreateViewMethod
was causing issues; The container is empty if it needs to be empty:
To do this, to check the blank and create a scene again:
View public viewCreview (LayoutEfletter Influent, View Group Container, bundle saved instenstate) {if (Routeview == empty) {// Raise the layout for this section route root = inflater.inflate (R. Fragment_A, Container, Incorrect); } Else {// Do not Re-Layout Layout. Back to // Creativity will be added to the visual piece. // Even though the parents are the same, can be added twice. // then we will have to delete the rootview from the existing original view group // (it will be added back). (ViewGroup) rootView.getParent ()) removeView (rootView). } Return route view;
Please check and let me know that it works.
Comments
Post a Comment