diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-12-22 18:29:32 -0800 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-12-22 18:29:32 -0800 |
commit | 7becaeea7b220ab6fbe93e35461c7734032e7af4 (patch) | |
tree | 81b55214535dec582158d4026eb99b29a82fb06c /core/java | |
parent | 3ce86481cbde92e2cb6fe3a46cbedd8b2a5c4b48 (diff) | |
download | frameworks_base-7becaeea7b220ab6fbe93e35461c7734032e7af4.zip frameworks_base-7becaeea7b220ab6fbe93e35461c7734032e7af4.tar.gz frameworks_base-7becaeea7b220ab6fbe93e35461c7734032e7af4.tar.bz2 |
Another stab at fixing issue #3149290 java.lang.RuntimeException:...
...Unable to pause activity
{com.android.settings/com.android.settings.applications.StorageUse}
Change-Id: Ibfa28a1c5af50dd150dfcafe71e905426d312643
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/widget/AbsListView.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 8e8b830..35ef4cb 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -974,8 +974,16 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te ss.position = getSelectedItemPosition(); ss.firstId = INVALID_POSITION; } else { - if (haveChildren) { - // Remember the position of the first child + if (haveChildren && mFirstPosition > 0) { + // Remember the position of the first child. + // We only do this if we are not currently at the top of + // the list, for two reasons: + // (1) The list may be in the process of becoming empty, in + // which case mItemCount may not be 0, but if we try to + // ask for any information about position 0 we will crash. + // (2) Being "at the top" seems like a special case, anyway, + // and the user wouldn't expect to end up somewhere else when + // they revisit the list even if its content has changed. View v = getChildAt(0); ss.viewTop = v.getTop(); int firstPos = mFirstPosition; |