use of android.support.v4.app.FragmentTransaction in project android-support-v4-googlemaps by petedoyle.
the class FragmentStackFragmentSupport method addFragmentToStack.
void addFragmentToStack() {
mStackLevel++;
// Instantiate a new fragment.
Fragment newFragment = FragmentStackSupport.CountingFragment.newInstance(mStackLevel);
// Add the fragment to the activity, pushing this transaction
// on to the back stack.
FragmentTransaction ft = getChildFragmentManager().beginTransaction();
ft.replace(R.id.simple_fragment, newFragment);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
ft.addToBackStack(null);
ft.commit();
}
use of android.support.v4.app.FragmentTransaction in project android-support-v4-googlemaps by petedoyle.
the class FragmentArgumentsSupport method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_arguments_support);
if (savedInstanceState == null) {
// First-time init; create fragment to embed in activity.
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Fragment newFragment = MyFragment.newInstance("From Arguments");
ft.add(R.id.created, newFragment);
ft.commit();
}
}
use of android.support.v4.app.FragmentTransaction in project mobile-android by photo.
the class SyncFragment method detachActiveFragment.
public void detachActiveFragment() {
if (activeFragment != null && !instanceSaved && !getActivity().isFinishing()) {
FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction();
transaction.detach(activeFragment);
transaction.commit();
// activeFragment = null;
}
}
use of android.support.v4.app.FragmentTransaction in project mobile-android by photo.
the class SyncFragment method selectFragment.
void selectFragment(Fragment fragment, boolean attachOnly) {
CommonUtils.debug(TAG, "Selecting fragment: " + fragment + "; attachOnly: " + attachOnly);
if (getActivity() == null) {
CommonUtils.debug(TAG, "Fragment is no more attached to activity.");
return;
}
FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction();
if (activeFragment != null && !activeFragment.isDetached()) {
transaction.detach(activeFragment);
}
if (attachOnly) {
transaction.attach(fragment);
} else {
transaction.replace(R.id.fragment_container, fragment, getTagForFragment(fragment));
}
transaction.commit();
activeFragment = fragment;
activeFragment.setMenuVisibility(mMenuVisible);
activeFragment.setUserVisibleHint(mUserVisibleHint);
}
use of android.support.v4.app.FragmentTransaction in project android by owncloud.
the class FileDisplayActivity method setSecondFragment.
/**
* Replaces the second fragment managed by the activity with the received as
* a parameter.
* <p/>
* Assumes never will be more than two fragments managed at the same time.
*
* @param fragment New second Fragment to set.
*/
private void setSecondFragment(Fragment fragment) {
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.right_fragment_container, fragment, TAG_SECOND_FRAGMENT);
transaction.commit();
}
Aggregations