diff --git a/api/current.txt b/api/current.txt index 37432528721d9..9df4c94219f69 100644 --- a/api/current.txt +++ b/api/current.txt @@ -4772,7 +4772,7 @@ package android.app { method public abstract android.app.FragmentManager.BackStackEntry getBackStackEntryAt(int); method public abstract int getBackStackEntryCount(); method public abstract android.app.Fragment getFragment(android.os.Bundle, java.lang.String); - method public abstract java.util.Collection getFragments(); + method public abstract java.util.List getFragments(); method public abstract android.app.Fragment getPrimaryNavigationFragment(); method public void invalidateOptionsMenu(); method public abstract boolean isDestroyed(); diff --git a/api/system-current.txt b/api/system-current.txt index a5666dc37aa2f..cab8a4267bf2c 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -4932,7 +4932,7 @@ package android.app { method public abstract android.app.FragmentManager.BackStackEntry getBackStackEntryAt(int); method public abstract int getBackStackEntryCount(); method public abstract android.app.Fragment getFragment(android.os.Bundle, java.lang.String); - method public abstract java.util.Collection getFragments(); + method public abstract java.util.List getFragments(); method public abstract android.app.Fragment getPrimaryNavigationFragment(); method public void invalidateOptionsMenu(); method public abstract boolean isDestroyed(); diff --git a/api/test-current.txt b/api/test-current.txt index 07a68c6910368..619e5c2956c51 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -4784,7 +4784,7 @@ package android.app { method public abstract android.app.FragmentManager.BackStackEntry getBackStackEntryAt(int); method public abstract int getBackStackEntryCount(); method public abstract android.app.Fragment getFragment(android.os.Bundle, java.lang.String); - method public abstract java.util.Collection getFragments(); + method public abstract java.util.List getFragments(); method public abstract android.app.Fragment getPrimaryNavigationFragment(); method public void invalidateOptionsMenu(); method public abstract boolean isDestroyed(); diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java index 3107453b9023b..05ac3cac443e8 100644 --- a/core/java/android/app/FragmentManager.java +++ b/core/java/android/app/FragmentManager.java @@ -314,14 +314,17 @@ public abstract class FragmentManager { public abstract Fragment getFragment(Bundle bundle, String key); /** - * Get a collection of all fragments that are currently added to the FragmentManager. + * Get a list of all fragments that are currently added to the FragmentManager. * This may include those that are hidden as well as those that are shown. * This will not include any fragments only in the back stack, or fragments that * are detached or removed. + *

+ * The order of the fragments in the list is the order in which they were + * added or attached. * - * @return A collection of all fragments that are added to the FragmentManager. + * @return A list of all fragments that are added to the FragmentManager. */ - public abstract Collection getFragments(); + public abstract List getFragments(); /** * Save the current instance state of the given Fragment. This can be @@ -907,12 +910,12 @@ final class FragmentManagerImpl extends FragmentManager implements LayoutInflate } @Override - public Collection getFragments() { + public List getFragments() { if (mAdded == null) { return Collections.EMPTY_LIST; } synchronized (mAdded) { - return (Collection) mAdded.clone(); + return (List) mAdded.clone(); } }