Well it worked if i just did it from the AppWidgetProvider.onUpdate. And this service i wrote uses the same approach as Jeff Sharkey (Android Team Developer) uses in his example Widget:
http://code.google.com/p/android-sky/source/browse/trunk/Sky/src/org/jsharkey/sky/UpdateService.java So what am i doing wrong? Should i still submit it to a handler? Can you explain me how todo that? On Jul 14, 10:44 am, Kostya Vasilyev <kmans...@gmail.com> wrote: > Are you calling updateAppWidget from the worker thread? > > If so, don't. UI calls can only be made from the UI thread. > > Use a Handler / Runnable to post data calculated by the worker thread to > the UI thread and call updateAppWidget from there. > > -- Kostya > > 14.07.2010 12:37, TjerkW пишет: > > > > > > > Basically i have an AppWidgetProvider which starts a Service on > > update. That service starts a thread and at the end it updates the > > widget by calling AppWidgetManager.updateAppWidget. > > > But i get a NullPointerException? What am i doing wrong? The Service > > is not in a different process.. > > > 07-14 10:30:29.936: INFO/HyvesWidgetProvider(12077): updateAppWidget > > appWidgetId=63 > > 07-14 10:30:35.156: DEBUG/dalvikvm(12077): threadid=14: still > > suspended after undo (sc=1 dc=1 s=Y) > > 07-14 10:30:35.156: DEBUG/dalvikvm(12077): GC_EXPLICIT freed 4078 > > objects / 373584 bytes in 97ms > > 07-14 10:30:36.711: WARN/dalvikvm(12077): threadid=14: thread exiting > > with uncaught exception (group=0x4001d7f0) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): FATAL EXCEPTION: > > Thread-16 > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): > > java.lang.NullPointerException > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > android.widget.RemoteViews > > $ReflectionAction.writeToParcel(RemoteViews.java:399) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > android.widget.RemoteViews.writeToParcel(RemoteViews.java:1003) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > com.android.internal.appwidget.IAppWidgetService$Stub > > $Proxy.updateAppWidgetIds(IAppWidgetService.java:374) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > android.appwidget.AppWidgetManager.updateAppWidget(AppWidgetManager.java: > > 246) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > android.appwidget.AppWidgetManager.updateAppWidget(AppWidgetManager.java: > > 265) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > com.hyves.android.widget.HyvesWidgetProvider.updateAppWidget(HyvesWidgetPro > > vider.java: > > 75) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > com.hyves.android.widget.HyvesWidgetService.onUserInfoRetrieved(HyvesWidget > > Service.java: > > 162) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > com.hyves.android.widget.HyvesWidgetService.access > > $2(HyvesWidgetService.java:149) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > com.hyves.android.widget.HyvesWidgetService > > $2.onItemRetrieved(HyvesWidgetService.java:123) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > com.hyves.android.widget.HyvesWidgetService > > $2.onItemRetrieved(HyvesWidgetService.java:1) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > com.hyves.android.proxy.content.CachePolicyImpl.getItemById(CachePolicyImpl > > .java: > > 33) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > com.hyves.android.proxy.content.BaseSourcesInfo.getItemById(BaseSourcesInfo > > .java: > > 90) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > com.hyves.android.widget.HyvesWidgetService.onBuzzItemRetrieved(HyvesWidget > > Service.java: > > 120) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > com.hyves.android.widget.HyvesWidgetService.access > > $0(HyvesWidgetService.java:118) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > com.hyves.android.widget.HyvesWidgetService > > $1.onItemRetrieved(HyvesWidgetService.java:96) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > com.hyves.android.widget.HyvesWidgetService > > $1.onItemRetrieved(HyvesWidgetService.java:1) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > com.hyves.android.proxy.content.CachePolicyImpl.getItemByParentIdAndPositio > > n(CachePolicyImpl.java: > > 68) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > com.hyves.android.proxy.content.BaseSourcesInfo.getItemByParentIdAndPositio > > n(BaseSourcesInfo.java: > > 98) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > com.hyves.android.widget.HyvesWidgetService.onUpdate(HyvesWidgetService.jav > > a: > > 89) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > com.hyves.android.widget.HyvesWidgetService.run(HyvesWidgetService.java: > > 83) > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): at > > java.lang.Thread.run(Thread.java:1096) > > -- > Kostya Vasilev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en