Java Code Examples for android.support.v4.app.fragmentmanager#putFragment()

The following examples show how to use android.support.v4.app.fragmentmanager#putFragment() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From WanAndroid with Apache License 2.0 6 votes vote down vote up
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt(KEY_BOTTOM_NAVIGATION_VIEW_SELECTED_ID, mBottomNavigationView.getSelectedItemId());
    FragmentManager fragmentManager = getSupportFragmentManager();
    if (mTimelineFragment.isAdded()) {
        fragmentManager.putFragment(outState, TimelineFragment.class.getSimpleName(), mTimelineFragment);
    }
    if (mCategoriesFragment.isAdded()) {
        fragmentManager.putFragment(outState, CategoriesFragment.class.getSimpleName(), mCategoriesFragment);
    }

    if (mAboutFragment.isAdded()) {
        fragmentManager.putFragment(outState, AboutFragment.class.getSimpleName(), mAboutFragment);
    }
}
 
Example 2
Source File: LoginActivity.java    From WanAndroid with Apache License 2.0 5 votes vote down vote up
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    FragmentManager manager = getSupportFragmentManager();
    if (loginFragment.isAdded()) {
        manager.putFragment(outState, LoginFragment.class.getSimpleName(), loginFragment);
    }
    if (signUpFragment.isAdded()) {
        manager.putFragment(outState, SignUpFragment.class.getSimpleName(), signUpFragment);
    }
}
 
Example 3
Source File: TimelineFragment.java    From WanAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
    super.onSaveInstanceState(outState);
    FragmentManager fragmentManager = getChildFragmentManager();
    if (articlesFragment.isAdded()){
        fragmentManager.putFragment(outState,ArticlesFragment.class.getSimpleName(),articlesFragment);
    }
    if (favoritesFragment.isAdded()){
        fragmentManager.putFragment(outState, FavoritesFragment.class.getSimpleName(), favoritesFragment);
    }
    if (readLaterFragment.isAdded()){
        fragmentManager.putFragment(outState, ReadLaterFragment.class.getSimpleName(), readLaterFragment);
    }
}
 
Example 4
Source File: ContactPickerActivity.java    From UnifiedContactPicker with Apache License 2.0 5 votes vote down vote up
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    FragmentManager fragmentManager = getSupportFragmentManager();
    if(fragmentManager != null)
        fragmentManager.putFragment(outState, FRAGMENT_KEY , mFragment);
}
 
Example 5
Source File: ActionbarActivity.java    From ui with Apache License 2.0 5 votes vote down vote up
@Override protected void onSaveInstanceState(Bundle outState) {
	super.onSaveInstanceState(outState);


	FragmentManager fragmentManager = getSupportFragmentManager();
	fragmentManager.putFragment(outState, "ONE", one);
	fragmentManager.putFragment(outState,"TWO", two);
	fragmentManager.putFragment(outState,"THREE", three);
	fragmentManager.putFragment(outState,"FOUR", four);
	fragmentManager.putFragment(outState,"FIVE", five);

}
 
Example 6
Source File: MainActivity.java    From ui with Apache License 2.0 5 votes vote down vote up
@Override protected void onSaveInstanceState(Bundle outState) {
	super.onSaveInstanceState(outState);
	

    FragmentManager fragmentManager = getSupportFragmentManager();
    fragmentManager.putFragment(outState, "ONE", one);
    fragmentManager.putFragment(outState,"TWO", two);
    fragmentManager.putFragment(outState,"THREE", three);
    fragmentManager.putFragment(outState,"FOUR", four);
    fragmentManager.putFragment(outState,"FIVE", five);

}
 
Example 7
Source File: MainActivity.java    From ui with Apache License 2.0 5 votes vote down vote up
@Override protected void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
//		if (ViewPager != null) {
//			outState.putInt(KEY_PAGE, pager.getCurrentItem());
//		} else {
//			outState.putInt(KEY_PAGE, lastPage);
//		}
	    FragmentManager fragmentManager = getSupportFragmentManager();
	    fragmentManager.putFragment(outState, "LEFT", leftfrag);
	    fragmentManager.putFragment(outState,"MIDDLE", midfrag);
	    fragmentManager.putFragment(outState,"RIGHT", rightfrag);
	}
 
Example 8
Source File: ActionbarActivity.java    From ui with Apache License 2.0 5 votes vote down vote up
@Override protected void onSaveInstanceState(Bundle outState) {
	super.onSaveInstanceState(outState);


	FragmentManager fragmentManager = getSupportFragmentManager();
	fragmentManager.putFragment(outState, "ONE", one);
	fragmentManager.putFragment(outState,"TWO", two);
	fragmentManager.putFragment(outState,"THREE", three);
	fragmentManager.putFragment(outState,"FOUR", four);
	fragmentManager.putFragment(outState,"FIVE", five);

}
 
Example 9
Source File: MainActivity.java    From FacebookNewsfeedSample-Android with Apache License 2.0 5 votes vote down vote up
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBoolean(SHOWING_SETTINGS_KEY, isShowingSettings());
    if (currentSlot != null) {
        outState.putString(TOKEN_CACHE_NAME_KEY, currentSlot.getTokenCacheName());
    }

    FragmentManager manager = getSupportFragmentManager();
    manager.putFragment(outState, SettingsFragment.TAG, settingsFragment);
    manager.putFragment(outState, ProfileFragment.TAG, profileFragment);

    Session.saveSession(currentSession, outState);
}