On Sep 27, 4:23 pm, sebastian_bugiu <sebastian.bugiu.reloa...@gmail.com> wrote: > I have an application in android market that does not work on htc > desire and I am positive the issue is not in my code. Basically I have > a private static final field that is initialized to a reference to an > object and yet whenever I access that object from another thread it > throws a NullPointerException even though it is initialized.
Are you sure you were really using private static final? Static finals are initialized when the class loads and will never change as long as that class remains loaded. All threads would be seeing the same value the entire time. The other code you showed can have a race condition in that first thread that assigns status may not have reconciled its local copy of the new Status object by the time the second thread tries to access it. You would need to synchronize both accesses or use volatile to keep them in sync. You are almost certainly not running into an HTC error. Doug -- 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