Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
I am Brazilian.
Error:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.IllegalArgumentException: No view found for id 0x7f0801e6 (com.example.applicationviewpager:id/lay_Interno) for fragment InternoFragment{d5fa25a} (f3e8a24f-1a76-4426-8021-3ff3d5fb5d1b id=0x7f0801e6)
Below is the link of 2 very simple projects that were developed using Android Studio to exemplify the error.
Project 1:
ApplicationNavigationDrawer that use FrameLayout:
Project 2:
ApplicationViewPager that use ViewPager2:
Open and run both projects to compare and check for the error.
Procedure:
Do the following:
Open and run project 1, using the navigationDrawer access the 2nd fragment, then rotate the device screen.
Result:
No mistakes.
Comments:
Through the getFragment function located in MainActivity.class I always return a valid Fragment (which has a view).
Now do the following:
Open and run project 2, swipe the screen to the left to access the 2nd fragment, then rotate the device screen.
Result:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.IllegalArgumentException: No view found for id 0x7f0801e6 (com.example.applicationviewpager:id/lay_Interno) for fragment InternoFragment{d5fa25a} (f3e8a24f-1a76-4426-8021-3ff3d5fb5d1b id=0x7f0801e6)
Comments:
When rotating the device screen, the createFragment function located in PaginaAdapter.class does not return a valid fragment.
I'm novice developer but understand that some android features like: Fragment, RecyclerView, etc need a valid view to use as a base.
So I would like some help to make this ApplicationViewPager which uses ViewPager2 work correctly similar to the ApplicationNavigationDrawer which use FrameLayout.
My email is: thiagoroma87@gmail.com
I am available and thank you in advance!
Kind regards Thiago...