It means multiple processes, as per:

http://code.google.com/android/intro/appmodel.html

What may be happening is that you are writing the new shared preferences at
the same time as the system kills the process, so the file write is not
completed, and the next time it is read it is unable to parse the truncated
file.  So you should only write the shared preferences at a time when you
know the system is keeping your application around -- in onReceiveIntent(),
a service, as part of the activity lifecycle, etc.

On Sun, Nov 30, 2008 at 9:13 PM, joshv <[EMAIL PROTECTED]> wrote:

>
> What exactly do the docs mean when they say 'multiple processes'.  Do
> they mean different threads in the same application?  Or do they mean
> for example a background service accessing a shared preference file at
> the same time a foreground process is accessing the same shared
> preference file?
>
> I am having intermittent issues with one of my apps loosing it's
> shared preferences.  My app uses threads to keep the UI responsive,
> and I just figured I had some sort of synchronization issue with
> saving preferences.  But no, I've locked down the critical sections
> with synchronized blocks and still, very rarely, my app will lose it's
> preferences.  It usually seems to happen when the app is killed by the
> OS, or by the debugger, normal resume/pause events never result in
> loosing the preferences.  But again it's intermittent.
>
> I have another app that's never lost it's preferences - but it's not
> multi-threaded.
>
> -josh
>
> On Nov 19, 1:55 pm, "Dianne Hackbod" <[EMAIL PROTECTED]> wrote:
>
> [snip...]
> >
> > I'm not sure I follow your reasoning -- if you are saying that your
> > application is all running in one process, why do you think the whole
> caveat
> > about not supporting multiple processes even applies?
> [...]
>
> >
>


-- 
Dianne Hackborn
Android framework engineer
[EMAIL PROTECTED]

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to