Are you sure you call commit() after done with your edits?  If you don't,
then the changes won't be written to disk, and at whatever point your
process is killed while in the background they will be lost.  That is the
only way I can think of off-hand to explain what you describe.

On Tue, Nov 18, 2008 at 9:09 PM, dar <[EMAIL PROTECTED]> wrote:

>
> I'm having an issue where some users are seeing the SharedPreferences
> disappearing after some time.  I have two separate Actvities, one
> writing, and the other reading.  I assume these two activities are
> both in the same process (they both run from the same app), but is
> this causing the problem?  What's curious to me is that I can't
> reproduce the problem myself on the G1.
>
> On Nov 18, 9:36 pm, "Dianne Hackbod" <[EMAIL PROTECTED]> wrote:
> > SharedPreferences should be completely thread safe.  Also, all of the
> normal
> > calls the system makes to your components happen in the same main thread
> of
> > the process, so except for special cases (as described in the app model
> doc)
> > you shouldn't be dealing with multithreading.
> >
> > Are all of these components running in the same process?  Right now
> > SharedPreferences does not deal well with multiple components in separate
> > processes trying to use the same preferences data.
> >
> >
> >
> >
> >
> > On Tue, Nov 18, 2008 at 6:24 PM, Eric B <[EMAIL PROTECTED]> wrote:
> >
> > > I have a PreferenceActivity that uses an xml file to automatically
> > > populate and save the preferences.  Sometimes though, when that
> > > activity is started, the preferences are blank.  However, if you go
> > > back later, they will reappear.
> >
> > > This is causing a lot of headaches with my app.  I have a Service and
> > > BroadcastReciever running in the background that are also accessing
> > > and (sometimes) updating the preferences.  Are there synchronization
> > > issues with shared preferences?  Maybe permission issues?
> >
> > > I'm really stuck here and would greatly appreciate any insight you can
> > > offer.
> >
> > > Thanks,
> > > Eric
> >
> > --
> > Dianne Hackborn
> > [EMAIL PROTECTED] Hide quoted text -
> >
> > - Show quoted text -
>
> >
>


-- 
Dianne Hackborn
[EMAIL PROTECTED]

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