In my Android app I have an event handler that gets called from another thread. When the handler is called some of my private fields are null so I get a NullPointerException because I'm trying to access a method from a null object. I cannot see why they would be null as I instantiate the fields earlier and I don't set the fields anywhere else.
Can this have something to do with cross threading? The fields are set in one thread but accessed by another thread..? No, right? They shouldn't be null.. I'm going crazy here, but it's probably a tiny mistake that I just can't spot right now.
I guess it's hard to answer when you don't have the code, but I can't post my whole solution here. Maybe someone can point me in the right direction for what to look for..?