[android-developers] How do I report a bug to htc?

2011-09-30 Thread sebastian_bugiu
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.

It works in the emulator but I have not tested the application on many
phones. But on those that I tested it works.

I am absolutely positive that the object is initialized before the
thread accessing it starts. I moved the initialization in the
constructor that completes before the thread starts. I removed static
final. Nothing. The thread UI calls surfaceCreated and in it I create
this object and start a thread that later accesses the object and
somehow accessing the field in the run() method causes
NullPointerException. If I access it from the UI thread it works. Can
a field be thread specific? And for everybody else be invisible? And
why only on HTC Desire (haven't tested other HTC phones). I thought it
might be some race condition or something since it has a faster CPU
but the code really looks like this:

status = new Status();
Thread thread = new Thread() {
 public void run() {
if (status == null) {
 throw new NullPointerException();
 }

}.start();

And on HTC is always null.

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


Re: [android-developers] How do I report a bug to htc?

2011-09-30 Thread Kostya Vasilyev

Potentially, it could be a race condition.

Try surrounding access to status with synchronized(something), or pass 
it into the thread via a constructor argument.


-- Kostya

28.09.2011 3:23, sebastian_bugiu пишет:

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.

It works in the emulator but I have not tested the application on many
phones. But on those that I tested it works.

I am absolutely positive that the object is initialized before the
thread accessing it starts. I moved the initialization in the
constructor that completes before the thread starts. I removed static
final. Nothing. The thread UI calls surfaceCreated and in it I create
this object and start a thread that later accesses the object and
somehow accessing the field in the run() method causes
NullPointerException. If I access it from the UI thread it works. Can
a field be thread specific? And for everybody else be invisible? And
why only on HTC Desire (haven't tested other HTC phones). I thought it
might be some race condition or something since it has a faster CPU
but the code really looks like this:

status = new Status();
Thread thread = new Thread() {
  public void run() {
 if (status == null) {
  throw new NullPointerException();
  }

}.start();

And on HTC is always null.



--
Kostya Vasilyev

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