I have got a Widget and it starts a task in onUpdate():

                timer = new Timer();
                myTime = new MyTime(appWidgetManager);
                timer.scheduleAtFixedRate(myTime, 1, 10000);


I try to stop it in onDeleted, because if I won't it would still be
active in the background, although I already deleted this Widget from
my Homescreen.

        @Override
        public void onDeleted(Context context, int[] appWidgetIds) {
                timer.cancel();
                super.onDeleted(context, appWidgetIds);
        };

But Eclipse gives me this error:

07-28 22:32:39.191: ERROR/AndroidRuntime(3804): FATAL EXCEPTION: main
07-28 22:32:39.191: ERROR/AndroidRuntime(3804):
java.lang.RuntimeException: Unable to start receiver
com.zucizu.waden.WadenNewsWidget: java.lang.NullPointerException
07-28 22:32:39.191: ERROR/AndroidRuntime(3804):     at
android.app.ActivityThread.handleReceiver(ActivityThread.java:1926)
07-28 22:32:39.191: ERROR/AndroidRuntime(3804):     at
android.app.ActivityThread.access$2400(ActivityThread.java:123)
07-28 22:32:39.191: ERROR/AndroidRuntime(3804):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:989)
...

What am I doing wrong?

-- 
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