/* FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); //---get the current display info--- WindowManager wm = getWindowManager(); Display d = wm.getDefaultDisplay(); if ((d.getRotation()==1)||(d.getRotation()==3)) { //---landscape mode--- Fragment1 fragment1 = new Fragment1(); // android.R.id.content refers to the content // view of the activity fragmentTransaction.replace( android.R.id.content, fragment1); } else { //---portrait mode--- Fragment2 fragment2 = new Fragment2(); fragmentTransaction.replace( android.R.id.content, fragment2); } //---add to the back stack--- fragmentTransaction.addToBackStack(null); fragmentTransaction.commit(); */