ConversationFragment conversationFragment = new ConversationFragment();
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.container, conversationFragment);
transaction.commit();
改成链式的,只用过一次的不用创建对象,一句写完就行了
ConversationFragment conversationFragment = new ConversationFragment();
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.container, conversationFragment)
.commitAllowingStateLoss();