@Override public void onNewTweet(Tweet tweet) { // HomeTimeLineFragment fragment = (HomeTimeLineFragment) adapterViewPager // .getItem(POSITION_OF_HOMETIMELINE); // supportFragmentManager = getSupportFragmentManager(); HomeTimeLineFragment fragment = (HomeTimeLineFragment) supportFragmentManager.findFragmentByTag( makeFragmentName(R.id.viewPager, POSITION_OF_HOMETIMELINE)); if (fragment != null) { fragment.addNewTweet(tweet); } }
@Override public Fragment getItem(int position) { switch (position) { case POSITION_OF_HOMETIMELINE: return HomeTimeLineFragment.newInstance(position, "Home"); case POSITION_OF_MENTIONS: return MentionsFragment.newInstance(position, "Mentions"); case POSITION_OF_DIRECTMSGS: return DirectMessagesFragments.newInstance(position, "Mentions"); default: return null; } }