@Override public void onAttachFragment(Fragment fragment) { if (fragment instanceof TopicViewFragment) { TopicViewFragment topicViewFragment = (TopicViewFragment) fragment; if (topicViewFragment.getTopicNode() == null && mTopicNode != null) { topicViewFragment.setTopicNode(mTopicNode); } } }
@Override public void onCreate(Bundle savedState) { super.onCreate(savedState); setContentView(R.layout.topic_view); showLoading(R.id.loading_container); if (savedState == null) { mTopicView = new TopicViewFragment(); Bundle extras = getIntent().getExtras(); if (extras != null) { if (extras.containsKey(GuideViewActivity.TOPIC_NAME_KEY)) { setTitle(extras.getString(GuideViewActivity.TOPIC_NAME_KEY)); } mTopicView.setArguments(extras); } FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.topic_view_fragment, mTopicView); ft.commit(); } else { mTopicView = (TopicViewFragment) getSupportFragmentManager().findFragmentById(R.id.topic_view_fragment); } mTopicNode = (TopicNode) getIntent().getSerializableExtra(TOPIC_KEY); if (mTopicNode != null) { setTitle(mTopicNode.getDisplayName()); App.sendScreenView("/category/" + mTopicNode.getName()); } }