Note that there are some explanatory texts on larger screens.

plurals
  1. POTextView extended; UnsupportedOperationException
    primarykey
    data
    text
    <p>I have extended a <code>TextView</code> to also implement <code>Checkable</code>. I have not touched any <code>TextView</code> stuff, except for <code>onCreateDrawableState</code>. Furthermore, I just implemented the Checkable methods. (abridged for clarity.)</p> <pre><code>public class CheckableTextView extends TextView implements Checkable { public CheckableTextView(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected int[] onCreateDrawableState(int extraSpace) { final int[] drawableState = super.onCreateDrawableState(extraSpace + 1); if (isChecked()) { mergeDrawableStates(drawableState, CheckedStateSet); } return drawableState; } </code></pre> <p>It compiles fine on ICS, but in Android 2.3 I get a pretty weird error when the program tried to inflate this view.</p> <pre><code>10-31 00:51:20.414: E/AndroidRuntime(601): FATAL EXCEPTION: main 10-31 00:51:20.414: E/AndroidRuntime(601): android.view.InflateException: Binary XML file line #3: Error inflating class net.blackenvelope.utrechtafval.map.layouts.CheckableTextView </code></pre> <p>...</p> <pre><code>10-31 00:51:20.414: E/AndroidRuntime(601): Caused by: java.lang.reflect.InvocationTargetException 10-31 00:51:20.414: E/AndroidRuntime(601): at java.lang.reflect.Constructor.constructNative(Native Method) 10-31 00:51:20.414: E/AndroidRuntime(601): at java.lang.reflect.Constructor.newInstance(Constructor.java:415) 10-31 00:51:20.414: E/AndroidRuntime(601): at android.view.LayoutInflater.createView(LayoutInflater.java:505) 10-31 00:51:20.414: E/AndroidRuntime(601): ... 45 more 10-31 00:51:20.414: E/AndroidRuntime(601): Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x2 10-31 00:51:20.414: E/AndroidRuntime(601): at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:463) 10-31 00:51:20.414: E/AndroidRuntime(601): at android.view.View.&lt;init&gt;(View.java:1963) 10-31 00:51:20.414: E/AndroidRuntime(601): at android.widget.TextView.&lt;init&gt;(TextView.java:344) 10-31 00:51:20.414: E/AndroidRuntime(601): at android.widget.TextView.&lt;init&gt;(TextView.java:337) 10-31 00:51:20.414: E/AndroidRuntime(601): at net.app.layouts.CheckableTextView.&lt;init&gt;(CheckableTextView.java:11) 10-31 00:51:20.414: E/AndroidRuntime(601): ... 48 more </code></pre> <p>I can't seem to find out what this type=0x2 means. </p> <p>Here is the XML:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;app.CheckableTextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/overlay_type_title" android:layout_width="match_parent" android:background="@drawable/overlay_list_bg_selector" android:layout_height="wrap_content" android:drawableLeft="@drawable/overlay_list_icon" android:drawablePadding="10dp" android:gravity="center_vertical" android:minHeight="?android:attr/listPreferredItemHeightSmall" android:paddingLeft="10dp" android:paddingRight="?android:attr/listPreferredItemPaddingRight" android:textAppearance="?android:attr/textAppearanceListItemSmall" &gt; &lt;/app.CheckableTextView&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload