Hi, I'm trying to update the widget whenever it receives a broadcast
message by sending appropriate intent.
However after receiving a broadcast message and sending intent it
doesn't do any job implemented in onUpdate()
Is it because I'm using the same class?

Sample code looks like this:

public class Example extends AppWidgetProvider {
  public void onUpdate(...) {
  ... do some job
  }
  public void onReceive(Context context, Intent intent) {
          if
(intent.getAction().equalsIgnoreCase(Intent.ACTION_TIME_CHANGED)) {
                  Intent message = new Intent();
                  message.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
                  message.setClass(context, Example.class);
<-------------------------------------------------------- HERE!
                  context.sendBroadcast(message);
          } else {
                  super.onReceive(context, intent);
          }
  }
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to