Btw. in the first post (don't find a way to edit) I wrote "final" but it's 
wrong, of course. I'm not using final in the code.

On Thursday, July 12, 2012 9:27:40 PM UTC+2, user123 wrote:
>
> Oh, right, thanks, I didn't think about this. This is very probably the 
> reason for most of the crashes... omg :/
>
> The things I'm passing are parts of a processed / filtered result from a 
> webservice, so I can't get them from a singleton or similar, I guess. 
> Serialization seems to be the way to go.
>
> On Thursday, July 12, 2012 9:17:17 PM UTC+2, TreKing wrote:
>>
>> On Thu, Jul 12, 2012 at 1:06 PM, user123 <[email protected]> wrote:
>>
>>> And Activity B is always started just by Activity A
>>
>>
>> That is an incorrect assumption.
>>
>> Picture this sequence of events: Activity A starts Activity B, then you 
>> close out the app by pressing Home, then you come back to your app after 
>> some time. In this case, the system will have killed your app (and wiped 
>> your statics) and will start where it last left off, which is Activity B, 
>> bypassing your static initialization and resulting in your null pointers.
>>
>> You need some sort of lazy initialization or Singleton pattern to ensure 
>> you always load the data you need if it's not already been loaded.
>>
>>
>> -------------------------------------------------------------------------------------------------
>> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago 
>> transit tracking app for Android-powered devices
>>
>>

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