Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid widget in emulator
    text
    copied!<p>I have an existing android app. I added a simple widget to it using the following:</p> <ul> <li>updated my manifest with a <code>&lt;receiver&gt;</code> block which provides information about my <code>AppWidgetProvider</code> implementation</li> <li>added a new xml files in res/xml with a <code>&lt;appwidget-provider&gt;</code> element that contains the height/width/updatePeriod/initialLayout/icon/label attributes</li> <li>added a simple default layout with an <code>ImageView</code> and a <code>TextView</code></li> <li>implemented my <code>AppWidgetProvider</code></li> </ul> <p>When I build and deploy this to the emulator my Widget doesn't show up in the list of widgets. Am I missing some step to 'install' the widget? Do I need to do anything special to make it appear in the emulator?</p> <p>EDIT: Here's what my manifest receiver looks like:</p> <pre><code>&lt;receiver android:name=".MyAppWidgetProvider" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.appwidget.action.APPWIDGET_UPDATE" /&gt; &lt;/intent-filter&gt; &lt;meta-data android:name="android.appwidget.provider" android:resource="@xml/my_appwidget_info" /&gt; &lt;/receiver&gt; </code></pre> <p>and here's what my my_appwidget_info.xml looks like:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:icon="@drawable/ic_logo" android:label="MySampleApp" android:minWidth="294dp" android:minHeight="72dp" android:updatePeriodMillis="86400000" android:initialLayout="@layout/my_app_widget" &gt; &lt;/appwidget-provider&gt; </code></pre>
 

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