Not real sure about this, just putting it out there ..
But is is possible that Activity2 is started in a separate Task to
Activity1?
I can find any doco confirming or denying, but perhaps separate Tasks
run in separate JVMs, hence the potential for non-initialization.
What's the taskAffinity?

I suspect that clearing the data is changing the behaviour because
this speed up / slows down one of the threads, thereby (generally)
avoiding the race condition.

I'd be tempted to
1) synchronize the method
2) make the static instance an instance of your Application class.


On Aug 30, 10:57 am, TreKing <treking...@gmail.com> wrote:
> On Sat, Aug 28, 2010 at 3:22 AM, William Ferguson <william.ferguson.au@
>
> gmail.com> wrote:
> > From the symptoms, the code you posted and the assumption that this section
> > of code is multi-threaded, it looks like a race condition.
>
> That's for the suggestion, but where the static instance is used is indeed
> in the main thread. The crash does occur in a separate thread, where the
> variable that's supposed to be valid from that static data is used later,
> but that thread is started long after the static instance is accessed (the
> thread is dependent on the user's selections).
>
> Though making it synchronized is probably a good idea regardless.
>
> Something interesting I just realized - this same static class is used in
> the main activity as part of loading the user's saved data and none of that
> has any issues, which you think would given the clearing the data fixes the
> problem.
>
> So: Activity1 -> Load user data using static data -> No problems (at least
> none reported)
> Activity2, launched from Activity1, try to use any instance stored in the
> static -> crashy crashy.
>
> On Sat, Aug 28, 2010 at 9:43 AM, Zsolt Vasvari <zvasv...@gmail.com> wrote:
> > I think the install/reinstall and clearing the user data are red herrings.
> >  The app might work again for the user if they just ran it again.
>
> I don't know. Every email I've gotten and all comments in the crash reports
> indicate it's a consistent crash occurring 100% of the time (and in the
> exact same location based on the ever-growing report count for the same
> stack trace).
>
> Clearing the data (or uninstalling / re-installing which clears the data as
> well) makes the problem go away each and every time.
>
> Thanks for the suggestions. I'm beyond baffled. I'm wishing it would start
> crashing on me so I can start debugging the stupid thing!
>
> -------------------------------------------------------------------------------------------------
> 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 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

Reply via email to