1. Check out our companion app, Forums for Android! Download from Google Play

Forcing Widget Update After Configuration Activity

Discussion in 'Application Development' started by Blrfl, Oct 2, 2010.

  1. Blrfl

    Blrfl Well-Known Member
    Thread Starter
    58

    This drew a big goose egg over on Stack Overflow (CLICKY), so I thought I'd give it a whirl here:

    I'm writing a widget with a configuration activity that needs to force an update after the activity is complete. The activity has a button whose ClickListener that calls this:

    Code (Text):
    1.  
    2. // ...Store Widget Configuration...
    3.  
    4. // Force an update  (Pretty much verbatim from the documentation)
    5. Context context = getApplicationContext();
    6. RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget);
    7. AppWidgetManager.getInstance(context).updateAppWidget(widget_id, views);
    8.  
    9. // Return the expected result
    10. Intent result = new Intent();
    11. result.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widget_id);
    12. setResult(RESULT_OK, result);
    13.  
    14. finish();
    The widget class gets all of the calls I'd expect except the forced update.

    Any ideas on why this doesn't work? More details are in the posting at SO.

    Thanks.

    --Mark
     

    Advertisement

Share This Page

Loading...