The problem was that sometimes the icon was not null and sometimes it was...
so was searching for a threading issue.
You could be more specific to throw a nullpointerexception straight away in
the api. NullPointerException("media cannot be null").But that requires some cpu cycles... 2010/7/14 Kostya Vasilyev <[email protected]> > It does - > > > 07-14 10:30:36.796: ERROR/AndroidRuntime(12077): > java.lang.NullPointerException > > > How more specific can you get? > > -- Kostya > > 14.07.2010 19:42, TjerkW пишет: > > Thanks... it was not a threading issue... i was calling >> >> views.setImageViewBitmap(R.id.profile_image, icon); >> >> with a null icon.... Most stupid mistake ever. >> But i think it would be better if android throws a better exception >> with a clear message. >> >> Anyways... solved! >> And a lot learned today! >> >> Thanks to you all! >> >> On Jul 14, 4:46 pm, Kostya Vasilyev<[email protected]> wrote: >> >> >>> ... which is in turn caused by a crash: >>> >>> 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) >>> >>> That is, updateAppWidget starts writing the RemoteViews object into a >>> Parcel, and crashes. Obviously the onUpdate() never returns, thus the >>> ANR. >>> >>> This runs on a separate thread, as can be seen further in the stack >>> trace: >>> >>> 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) >>> >>> Either it's really a threading problem, or else some data related to >>> RemoteViews is null (such as updateViews.setTextViewText(R.id.xxx, >>> null), or even the RemoteViews object itself is null). The latter one >>> should be easy to check by stepping through in the debugger. >>> >>> -- Kostya >>> >>> 14.07.2010 18:28, Tjerk Gmail пишет: >>> >>> >>> >>> >>> >>> >>> >>>> Aaah cool i didnt think of that problem! >>>> On Jul 14, 2010, at 4:15 PM, Mark Murphy wrote: >>>> >>>> >>> >>> >>>> On Wed, Jul 14, 2010 at 10:00 AM, TjerkW<[email protected]> wrote: >>>>> >>>>> >>>> >>> >>>> Hmm yeah,.. im trying to make a simple widget now and adding more >>>>>> stuff. >>>>>> >>>>>> >>>>> >>> >>>> However maybe this output from LogCat also helps: >>>>>> >>>>>> >>>>> >>> >>>> 07-14 15:57:58.845: ERROR/ActivityManager(59): ANR in >>>>>> com.hyves.android.application >>>>>> 07-14 15:57:58.845: ERROR/ActivityManager(59): Reason: Broadcast of >>>>>> Intent { act=android.appwidget.action.APPWIDGET_UPDATE >>>>>> cmp=com.hyves.android.application/ >>>>>> com.hyves.android.widget.HyvesWidgetProvider (has extras) } >>>>>> >>>>>> >>>>> >>> >>>> This should only happen if onUpdate() of your AppWidgetProvider is >>>>> taking too long. This may be tied to some of the funky thread locking >>>>> you're trying to do. >>>>> >>>>> >>>> >>> >>>> -- >>>>> Mark Murphy (a Commons Guy) >>>>> http://commonsware.com|http://github.com/commonsguy >>>>> http://commonsware.com/blog|http://twitter.com/commonsguy<http://commonsware.com/blog%7Chttp://twitter.com/commonsguy> >>>>> >>>>> >>>> >>> >>>> _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9 >>>>> Available! >>>>> >>>>> >>>> >>> >>>> -- >>>>> 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]<android-developers%[email protected]> >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/android-developers?hl=en >>>>> >>>>> >>>> >>> >>>> Tjerk Wolterink >>>> T +31645300385 >>>> [email protected] >>>> http://twitter.com/tjerkw >>>> http://tjerkwolterink.hyves.nl >>>> >>>> >>> -- >>> Kostya Vasilev -- WiFi Manager + pretty widget -- >>> http://kmansoft.wordpress.com >>> >>> >> >> > > > -- > 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 [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- -- Tjerk Wolterink @ GMail -- 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

