Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7daaa98c authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Fix issue #3149290: java.lang.RuntimeException: Unable to pause activity" into gingerbread

parents 52078255 99441c45
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -963,7 +963,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te

        SavedState ss = new SavedState(superState);

        boolean haveChildren = getChildCount() > 0;
        boolean haveChildren = getChildCount() > 0 && mItemCount > 0;
        long selectedId = getSelectedItemId();
        ss.selectedId = selectedId;
        ss.height = getHeight();
@@ -978,8 +978,12 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                // Remember the position of the first child
                View v = getChildAt(0);
                ss.viewTop = v.getTop();
                ss.position = mFirstPosition;
                ss.firstId = mAdapter.getItemId(mFirstPosition);
                int firstPos = mFirstPosition;
                if (firstPos >= mItemCount) {
                    firstPos = mItemCount - 1;
                }
                ss.position = firstPos;
                ss.firstId = mAdapter.getItemId(firstPos);
            } else {
                ss.viewTop = 0;
                ss.firstId = INVALID_POSITION;