Search code examples
androidwidgetandroid-4.0-ice-cream-sandwich

Widget is shown as 0x0 and crashes Launcher


So, I have declared a widget for my app and wanted to try it on the Ice Cream Sandwich emulator, however when I select it, it crashes the launcher.

The problem is, that the launcher thinks width and heigt would equal 0 (it also lists my widget as a 0x0 widget), so I guess there is a problem in my declaration

E/AndroidRuntime(  709): java.lang.IllegalArgumentException: width and height must be > 0
E/AndroidRuntime(  709):    at android.graphics.Bitmap.createBitmap(Bitmap.java:603)
E/AndroidRuntime(  709):    at android.graphics.Bitmap.createBitmap(Bitmap.java:585)
[...]

This is my widget declaration:

<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider
  xmlns:android="http://schemas.android.com/apk/res/android">
   android:updatePeriodMillis="7200000" 
    android:initialLayout="@layout/widget"
    android:minHeight="72dp" android:minWidth="90dp"> 
</appwidget-provider>

Is there something wrong with minHeight and minWidth?


Solution

  • Just in case someone made the same mistake: This was due to a syntax error (see comments above) the compiler didn't recognize.