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 at 12:53 PM, DraganA <[email protected]> wrote:
> 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 <[email protected]> wrote:
>> 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 LFPhttp://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 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 TabActivity {
>>
>> >     private List<String> list;
>>
>> >     public void onCreate(Bundle savedInstanceState) {
>> >         list = new ArrayList<String>();
>> >     }
>>
>> >     protected void onDestroy() {
>> >         list.clear();
>> >     }
>> > }
>
> --
> 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

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

Reply via email to