summaryrefslogtreecommitdiffstats
path: root/core/java/android/content
diff options
context:
space:
mode:
authorPhilip Milne <pmilne@google.com>2012-02-22 16:34:51 -0800
committerPhilip Milne <pmilne@google.com>2012-02-22 18:32:39 -0800
commitc29f031598811486d83f418fd08fbfe1fc41788a (patch)
tree6a98ca1627cb484e2496aac59c7c89419c8de4d7 /core/java/android/content
parent8ad41a3fdc140ef7dfc481d7db55fd73911f7b88 (diff)
downloadframeworks_base-c29f031598811486d83f418fd08fbfe1fc41788a.zip
frameworks_base-c29f031598811486d83f418fd08fbfe1fc41788a.tar.gz
frameworks_base-c29f031598811486d83f418fd08fbfe1fc41788a.tar.bz2
Fix for bug 6050753.
The method: TypedArray: getLayoutDimension(int, String) throws an undocumented exception when either the width and/or height attributes are undefined. See the bug report above for reasons why this was deemed unhelpful both in the tools area and to developers in general. Fix by: 1. Documenting the conditions under which the method raises an exception. 2. Deprecating the method, advising callers to supply a default instead. Additionally, redefine the: ViewGroup: setBaseAttributes(TypedArray, int, int); methods to provide the appropriate defaults in ViewGroup subclasses as advised above. For the platform layouts the default value is WRAP_CONTENT (and is defined in the ViewGroup.LayoutParams class). The special cases are accomodated in LayoutParams subclasses in the following cases: Subclass width height FrameLayout.LayoutParams: MATCH_PARENT, MATCH_PARENT TableLayout.LayoutParams: MATCH_PARENT, WRAP_CONTENT TableRow.LayoutParams: MATCH_PARENT, WRAP_CONTENT Change-Id: I335a3bd8e2d7f7866692898ed73492635a5b61ea
Diffstat (limited to 'core/java/android/content')
-rw-r--r--core/java/android/content/res/TypedArray.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/java/android/content/res/TypedArray.java b/core/java/android/content/res/TypedArray.java
index 2df492e..281b843 100644
--- a/core/java/android/content/res/TypedArray.java
+++ b/core/java/android/content/res/TypedArray.java
@@ -469,13 +469,20 @@ public class TypedArray {
* {@link android.view.ViewGroup}'s layout_width and layout_height
* attributes. This is only here for performance reasons; applications
* should use {@link #getDimensionPixelSize}.
- *
+ *
* @param index Index of the attribute to retrieve.
* @param name Textual name of attribute for error reporting.
*
* @return Attribute dimension value multiplied by the appropriate
* metric and truncated to integer pixels.
+ *
+ * @throws RuntimeException
+ * if this TypedArray does not contain an entry for <code>index</code>
+ *
+ * @deprecated Use {@link #getLayoutDimension(int, int)} instead.
+ *
*/
+ @Deprecated
public int getLayoutDimension(int index, String name) {
index *= AssetManager.STYLE_NUM_ENTRIES;
final int[] data = mData;