I am having a problem with Fragments and orientation change.
I have an application which has a MainActivity which handles the switching up
if(savedInstanceState == null) is not working always. sometimes savedInstanceState != null while you need to add another fragment because of landscape orientation.
Another approach is to test whether fm.findFragmentById(R.id.frameLayoutLeft), no matter what the orientation is, is null or not, if so, than create a new fragment instance otherwise do nothing. If you need a second fragment in landscape mode, you need first check whether it's landscape or not if so, check whether fm.findFragmentById(R.id.frameLayoutRight) is null or not. if null, than create, otherwise do nothing because it's already there retained by Android OS.