I have activity and two layouts for it defined:
- layout-large-land
- layout
1st layout is for large screens in landscape mode, 2nd is for other cases. The 1st layout contains:
- fragment1
- fragment2
The 2nd layout contains:
- fragment1
When I start the app in landscape mode on large screen, the getSupportFragmentManager().findFragmentById() called in Activity.onCreate() correctly returns both fragments. After orientation change to portrait, getSupportFragmentManager().findFragmentById() returns not 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 while accessing it. It should be null, shouldn't it?