Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The way the <code>AppWidgetManager</code> interacts with your <code>AppWidgetProvider</code> is not as documented. The documentation claims that if you have a configure activity, <code>onUpdate</code> is not called.</p> <p>In fact, <code>onUpdate</code> is called before the configure activity starts. It's not called when the activity finishes. Looking at your <code>onUpdate</code>, it appears that if the appwidget isn't configured yet, it leaves the <code>ImageView</code> blank. Even without seeing your configure activity, I guess that what's going on is this:</p> <ul> <li><code>AppWidgetManager</code> creates the new widget and calls <code>onUpdate</code>. Because the new widget is not yet configured, you don't set the <code>ImageView</code> to an image.</li> <li>The configure activity runs and sets <code>RESULT_OK</code>. The widget is now configured, but hasn't been updated again, so the <code>ImageView</code> is still blank.</li> <li>When you resize or move the widget, the <code>AppWidgetManager</code> calls <code>onUpdate</code> again. This time, your code reads the widget configuration and sets the <code>ImageView</code>. Now the widget shows the chosen image.</li> </ul> <p>The answer is that when your configure activity finishes, it should send an intent to your <code>AppWidgetProvider</code> to have it update again. This isn't a panacea, though, as there are other bugs in <code>AppWidgetProvider</code>. For example, if you do an orientation change while the configure activity is running, restarting it, the <code>AppWidgetProvider</code> hides the appwidget from the screen, even after you finish and return <code>RESULT_OK</code>. Changing the orientation again while the launcher is showing (after the configure activity has finished) makes the appwidget appear.</p> <p>The reason I know all this is that I've had the same problems writing a similar app, which may be helpful to you if you're struggling with this functionality. <strong>Showr</strong> displays images on the home screen or lock screen. The images can be chosen from other apps on the device (such as the Gallery), downloaded from a URL, or updated from an RSS or Atom feed. It even scales the images to an appropriate size and can crop them to fit the appwidget. It's a <a href="https://play.google.com/store/apps/details?id=com.shadowburst.showr" rel="nofollow">free download from Google Play</a>.</p>
    singulars
    1. This table or related slice is empty.
    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.
    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