public class FragmentTools extends Object
Fragments.| Constructor and Description |
|---|
FragmentTools() |
| Modifier and Type | Method and Description |
|---|---|
static Fragment |
embedFragment(Class<? extends Fragment> fragmentClass,
int containerID,
FragmentActivity parent,
String tag,
Bundle arguments)
Creates and embeds a new
Fragment (given by fragmentClass) into the
container with the ID containerID of the FragmentActivity parent,
with given tag and arguments. |
static Fragment |
embedFragment(Class<? extends Fragment> fragmentClass,
int containerID,
FragmentManager fragmentManager,
String tag,
Bundle arguments)
Creates and embeds a new
Fragment (given by fragmentClass) into the
container with the ID containerID of the FragmentManager parent,
with given tag and arguments. |
static Fragment |
embedFragment(Class<? extends Fragment> fragmentClass,
int containerID,
Fragment parent,
String tag,
Bundle arguments)
|
static void |
removeFragment(FragmentManager fragmentManager,
Fragment fragment)
Removes the specified
Fragment from view. |
static void |
removeFragment(FragmentManager fragmentManager,
String tag)
Removes the
Fragment specified by the tag from view. |
public static Fragment embedFragment(Class<? extends Fragment> fragmentClass, int containerID, FragmentActivity parent, String tag, Bundle arguments) throws InstantiationException, IllegalAccessException
Fragment (given by fragmentClass) into the
container with the ID containerID of the FragmentActivity parent,
with given tag and arguments.fragmentClass - The class of the new fragment that shall be created and embedded.containerID - The ID of the container that shall receive the new fragment.parent - The Activity containing the container.tag - The tag that's assigned to the fragment when attaching it to the
parent. May be null or empty.arguments - Possible arguments to be passed on to the fragment, may be null.IllegalAccessExceptionInstantiationExceptionpublic static Fragment embedFragment(Class<? extends Fragment> fragmentClass, int containerID, Fragment parent, String tag, Bundle arguments) throws InstantiationException, IllegalAccessException
Fragment (given by fragmentClass) into the
container with the ID containerID of the Fragment parent,
with given tag and arguments.fragmentClass - The class of the new fragment that shall be created and embedded.containerID - The ID of the container that shall receive the new fragment.parent - The Fragment containing the container.tag - The tag that's assigned to the fragment when attaching it to the
parent. May be null or empty.arguments - Possible arguments to be passed on to the fragment, may be null.IllegalAccessExceptionInstantiationExceptionpublic static Fragment embedFragment(Class<? extends Fragment> fragmentClass, int containerID, FragmentManager fragmentManager, String tag, Bundle arguments) throws InstantiationException, IllegalAccessException
Fragment (given by fragmentClass) into the
container with the ID containerID of the FragmentManager parent,
with given tag and arguments.fragmentClass - The class of the new fragment that shall be created and embedded.containerID - The ID of the container that shall receive the new fragment.fragmentManager - The FragmentManager that shall be used to receive and manage the
fragment.tag - The tag that's assigned to the fragment when attaching it to the
parent. May be null or empty.arguments - Possible arguments to be passed on to the fragment, may be null.IllegalAccessExceptionInstantiationExceptionpublic static void removeFragment(FragmentManager fragmentManager, String tag) throws InstantiationException, IllegalAccessException
Fragment specified by the tag from view.fragmentManager - The FragmentManager that shall be used to receive and manage the
fragment.tag - The tag that was assigned to the fragment when it was attaching to the
parent.InstantiationExceptionIllegalAccessExceptionpublic static void removeFragment(FragmentManager fragmentManager, Fragment fragment) throws InstantiationException, IllegalAccessException
Fragment from view.fragmentManager - The FragmentManager that shall be used to receive and manage the
fragment.fragment - The Fragment to be removed.InstantiationExceptionIllegalAccessException