From 4797f020cd255aa606d0bb1ca419de0d4facc3c6 Mon Sep 17 00:00:00 2001 From: Gilles Debunne Date: Fri, 25 Feb 2011 14:34:20 -0800 Subject: [PATCH] DO NOT MERGE Cherry-pick of cd59febcea2 from master AIOOB exception fix in TabWidget Bug http://code.google.com/p/android/issues/detail?id=15005 The problem was not specific to the legacy theme. The code that first measure the tab's width with no contraint was incorrectly using the mImposedTabsWidth array which could not have the right size if a child was added. The first measure after a child is added should indeed crash. Could be investigated. This fix is sure anyway. Change-Id: If5015aaa2d5574939fd5d6c6362ed6db94d35d4a --- core/java/android/widget/TabWidget.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/widget/TabWidget.java b/core/java/android/widget/TabWidget.java index 22f6f4ed93d8..d74ef245e5f7 100644 --- a/core/java/android/widget/TabWidget.java +++ b/core/java/android/widget/TabWidget.java @@ -174,8 +174,8 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { void measureHorizontal(int widthMeasureSpec, int heightMeasureSpec) { // First, measure with no constraint final int unspecifiedWidth = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); - super.measureHorizontal(unspecifiedWidth, heightMeasureSpec); mImposedTabsHeight = -1; + super.measureHorizontal(unspecifiedWidth, heightMeasureSpec); int extraWidth = getMeasuredWidth() - MeasureSpec.getSize(widthMeasureSpec); if (extraWidth > 0) { -- 2.11.0