thanks
but what is this "extras.getInt" when I copy your code "extras" is
not defined
maybe you have a short workaround for that:
@Override
public void onUpdate(Context context, AppWidgetManager
appWidgetManager,
int[] appWidgetIds) {
//bellow I just get my data, i dont know how to get
them in UpdateService
appWidgetIds2=appWidgetIds.clone();
appWidgetManager2=appWidgetManager;
context2=context;
context.startService(new Intent(context,
UpdateService.class));
}
static void updateAppWidget(Context context, AppWidgetManager
appWidgetManager,
int appWidgetId, String titlePrefix) {
//here is usualy my Update Code
}
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) {
final int appWidgetId = extras.getInt
(AppWidgetManager.EXTRA_APPWIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID);
if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
this.onDeleted(context, new int[] { appWidgetId });
}
} else {
super.onReceive(context, intent);
}
}
public static class UpdateService extends Service {
@Override
public void onStart(Intent intent, int startId) {
final int N = appWidgetIds2.length;
for (int i = 0; i < N; i++) {
appWidgetId = appWidgetIds2[i];
String titlePrefix = setwidgetuser.loadTitlePref
(context2,appWidgetId);
updateAppWidget(context2, appWidgetManager2,
appWidgetId,
titlePrefix);
}
Log.d("MYDAY-WIDGET", "----Updates DONE---");
}
On Apr 23, 9:02 pm, Jeff Sharkey <[email protected]> wrote:
> So just a heads up that we won't be able to fix the onDeleted() bug
> for the 1.5 SDK. Here is a quick workaround that you can patch
> against your class that extends AppWidgetProvider to correctly catch
> and handle the onDeleted() event.
>
> @Override
> public void onReceive(Context context, Intent intent) {
> final String action = intent.getAction();
> if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) {
> final int appWidgetId = extras.getInt
> (AppWidgetManager.EXTRA_APPWIDGET_ID,
> AppWidgetManager.INVALID_APPWIDGET_ID);
> if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
> this.onDeleted(context, new int[] { appWidgetId });
> }
> } else {
> super.onReceive(context, intent);
> }
>
> }
>
> j
>
> On Apr 20, 4:43 pm, Jeff Sharkey <[email protected]> wrote:> >
> In onActivityResult(), the cancellation is checked for request
> > > code REQUEST_PICK_APPWIDGET whereas it should be checking
> > > for REQUEST_CREATE_APPWIDGET.
>
> > Oops, you're right, thanks for catching that. For the example widgets
> > I've been writing that use configuration steps, I've been keeping an
> > internal CONFIGURED flag which I use to skip updates. Because I was
> > skipping non-configured widget updates, I never noticed this myself.
> > (I also used this flag to skip the first update before the
> > configuration step has been completed.)
>
> > Also, a quick update on the fixes: most of them will be delayed until
> > the next platform release because the device-bound code is already
> > frozen. We could fix it for the SDK, but it would be bad to have
> > different behavior between the two. We definitely have bugs filed for
> > these, and they will be fixed.
>
> > Thanks for digging in and finding them. :)
>
> > --
> > Jeff Sharkey
> > [email protected]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---