方向变化时处理片段的简便方法
public class MainActivity extends Activity implements MainMenuFragment.OnMainMenuItemSelectedListener { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager .beginTransaction(); // add menu fragment MainMenuFragment myFragment = new MainMenuFragment(); fragmentTransaction.add(R.id.menu_fragment, myFragment); //add content DetailPart1 content1= new DetailPart1 (); fragmentTransaction.add(R.id.content_fragment, content1); fragmentTransaction.commit(); } public void onMainMenuSelected(String …