[android-developers] Re: unreasonable NullPointerException in onDestroy()

2011-10-12 Thread Eugene Beletskiy
Can you post a stack trace (from Android Market) and say what is the name of a class you provided a peace of code for? For a meantime you need to inject *Log* into your code (*onDestroy()*) to see why you get null pointer exception. Looking at the code you posted everything should work ok. If

[android-developers] Re: unreasonable NullPointerException in onDestroy()

2011-10-08 Thread Goodwin
I have run these code. no error. On Oct 8, 4:34 pm, DraganA dand...@gmail.com wrote: I'm puzzled as to why I'm getting Null pointer exception in the construct below, knowing the Activity life cycle, it shouldn't happen. Could the clue be in TabActivity?? public class Main extends

[android-developers] Re: unreasonable NullPointerException in onDestroy()

2011-10-08 Thread DraganA
I have run it too before I released my app, but still got an error report through Developers console. On Oct 8, 10:03 am, Goodwin purerain2...@163.com wrote: I have run these code. no error. On Oct 8, 4:34 pm, DraganA dand...@gmail.com wrote: I'm puzzled as to why I'm getting Null

[android-developers] Re: unreasonable NullPointerException in onDestroy()

2011-10-08 Thread Studio LFP
Based on that, you shouldn't get a crash, but obviously that's not the full code you are using. Are you changing that variable at any other point in the code? Steven Studio LFP http://www.studio-lfp.com On Saturday, October 8, 2011 3:34:15 AM UTC-5, DraganA wrote: I'm puzzled as to why I'm

[android-developers] Re: unreasonable NullPointerException in onDestroy()

2011-10-08 Thread DraganA
That's the problem, the list is created in onCreate() method and is not reassigned or set to null anywhere. I forgot to say, the null pointer happens in onDestroy() method in list.clear() line. From that I can only deduce that onDestroy() is called before onCreate() On Oct 8, 5:42 pm, Studio LFP

Re: [android-developers] Re: unreasonable NullPointerException in onDestroy()

2011-10-08 Thread Kristopher Micinski
That won't happen unless your user is doing something stupid, how many of these have you had reported? (Could this happen if someone was using instrumentation on your app?) OnDestroy won't be called before onCreate, at least using the plan old unmodded Android system. Kris On Sat, Oct 8, 2011

[android-developers] Re: unreasonable NullPointerException in onDestroy()

2011-10-08 Thread Studio LFP
Without code samples, I don't think anyone is going to be able to help you find your issue. I use this all the time and the only time I have seen it not work was when I made a mistake somewhere else in the code. I do usually do a null check on things in the onDestory before I use them because

Re: [android-developers] Re: unreasonable NullPointerException in onDestroy()

2011-10-08 Thread Kostya Vasilyev
Calling finish() from onCreate still results in onDestroy getting called. So if your onCreate calls finish() and returns -- before you initialize the list -- perhaps as part of displaying the license agreement, or something else along those lines -- then in onDestroy the list will still be

[android-developers] Re: unreasonable NullPointerException in onDestroy()

2011-10-08 Thread DraganA
My bad, I just realised I do call finish in onCreate and return before the variable is initialised. Kostya explained most of it. Thanks. On Oct 8, 6:30 pm, Kostya Vasilyev kmans...@gmail.com wrote: Calling finish() from onCreate still results in onDestroy getting called. So if your onCreate

Re: [android-developers] Re: unreasonable NullPointerException in onDestroy()

2011-10-08 Thread Kristopher Micinski
If you download the source tree (if it ever comes back up again), I think you might find an interesting read in the code that starts up an application, I think ActivityThread. It's not too much code, mostly calling instrumentation in the right places, and provides a nice read for any systems

Re: [android-developers] Re: unreasonable NullPointerException in onDestroy()

2011-10-08 Thread Kristopher Micinski
I should have been more clear about distinguishing between Activity and ``app'' here..., but I think you get the idea :-) kris On Sat, Oct 8, 2011 at 6:37 PM, Kristopher Micinski krismicin...@gmail.com wrote: If you download the source tree (if it ever comes back up again), I think you might