I have activity and two layouts for it:
- layout-large-land
- location
The first layout for large screens in landscape mode, the second for other cases. The first layout contains:
The second layout contains:
When I launch the application in landscape mode on the big screen, getSupportFragmentManager().findFragmentById() , called in Activity.onCreate() , correctly returns both fragments. After changing the portrait orientation, getSupportFragmentManager().findFragmentById() does not return null for fragment2 , but it should return null because this fragment is not defined in this layout. The problem is that the returned fragment object is incorrect, and I get null pointer exceptions when accessing it. It must be null , right?
android android-orientation fragment
cubesoft
source share