use of android.support.v4.app.FragmentTransaction in project UltimateAndroid by cymcsg.
the class BasicUtils method addFragmentToActivity.
/**
* The {@code fragment} is added to the container view with id {@code frameId}. The operation is
* performed by the {@code fragmentManager}.
*/
public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, int frameId) {
Preconditions.checkNotNull(fragmentManager);
Preconditions.checkNotNull(fragment);
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.add(frameId, fragment);
transaction.commit();
}
use of android.support.v4.app.FragmentTransaction in project android-betterpickers by code-troopers.
the class SampleNumberUsingFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.frame_layout);
Fragment fragment = new SampleNumberFragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.frame, fragment);
transaction.commit();
}
use of android.support.v4.app.FragmentTransaction in project Android-PanesLibrary by cricklet.
the class PhoneDelegate method setMenuFragment.
@Override
public void setMenuFragment(Fragment f) {
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.menu_frame, f);
ft.commit();
wMenuFragment = new WeakReference<Fragment>(f);
}
use of android.support.v4.app.FragmentTransaction in project Libraries-for-Android-Developers by eoecn.
the class ActionBarImpl method selectTab.
@Override
public void selectTab(Tab tab) {
if (getNavigationMode() != NAVIGATION_MODE_TABS) {
mSavedTabPosition = tab != null ? tab.getPosition() : INVALID_POSITION;
return;
}
FragmentTransaction trans = null;
if (mActivity instanceof FragmentActivity) {
trans = ((FragmentActivity) mActivity).getSupportFragmentManager().beginTransaction().disallowAddToBackStack();
}
if (mSelectedTab == tab) {
if (mSelectedTab != null) {
mSelectedTab.getCallback().onTabReselected(mSelectedTab, trans);
mTabScrollView.animateToTab(tab.getPosition());
}
} else {
mTabScrollView.setTabSelected(tab != null ? tab.getPosition() : Tab.INVALID_POSITION);
if (mSelectedTab != null) {
mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans);
}
mSelectedTab = (TabImpl) tab;
if (mSelectedTab != null) {
mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans);
}
}
if (trans != null && !trans.isEmpty()) {
trans.commit();
}
}
use of android.support.v4.app.FragmentTransaction in project SharedPreferenceInspector by PrashamTrivedi.
the class SharedPrefsBrowser method startFragment.
/**
* Start given Fragment
*
* @param fragment
* : Fragment Instance to start.
* @param tag
* : Tag to be notified when adding to backstack
* @param canAddToBackstack
* : pass <code>true</code> if you want to add this item in backstack. pass <code>false</code> otherwise
*/
public void startFragment(Fragment fragment, String tag, boolean canAddToBackstack) {
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction().replace(R.id.fragmentContainer, fragment);
if (canAddToBackstack) {
transaction.addToBackStack(tag);
}
transaction.commit();
}
Aggregations