Android Home Screen Widget Failing with EditText

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-05-26T18:56:58Z Indexed on 2010/05/26 19:01 UTC
Read the original article Hit count: 368

Filed under:

Whenever I add an EditText widget to the layout of my home screen widget (confusing how the term "widget" is being used twice in the Android lexicon :-/ ), I receive the "Problem Loading Widget" error box.

Here is the layout I'm attempting; if you remove the EditText, it works...

<

RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">

        <Button
                android:id="@+id/button_generate"
                android:layout_width="54px"
                android:layout_height="54px"
                android:text="Generate"
                android:textSize="10sp"
                android:gravity="center"
                android:layout_alignParentTop="true"
                android:layout_toRightOf="@+id/edittext_key">
        </Button>   

        <TextView
                android:id="@+id/textview_hash"
                android:layout_width="75px"
                android:layout_height="45px"
                android:text="Password"
                android:textSize="11sp"
                android:gravity="left"
                android:layout_alignParentTop="true"
                android:layout_toLeftOf="@+id/edittext_key">
        </TextView>

        <EditText
                android:id="@+id/edittext_data2"
                android:layout_width="200px"
                android:layout_height="50px"
                android:textSize="12sp"
                android:layout_marginTop="20px"
                android:layout_alignParentTop="true"
                android:layout_centerHorizontal="true">
        </EditText> </RelativeLayout>

Now, the Google Search home screen widget has an EditText, so it's obviously legal to implement. Any thoughts on why this is not working?

© Stack Overflow or respective owner

Related posts about android