Ok, then SharePreferences should be ok in multi-threaded applications.

Regarding process death and preferences, I thought the same thing so I
scaled back my persistence code to only save preferences in an onPause
().  It was my understanding that even when a task is killed, the
onPause is called before the process is terminated - is that not the
case?  Can the process be killed in the middle of the onPause()
processing?  Perhaps this is a debugger only phenomenon?

On Nov 30, 11:41 pm, "Dianne Hackborn" <[EMAIL PROTECTED]> wrote:
> 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.
>

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