[Mono-bugs] [Bug 692215] New: "Remove Previous Version.." likely kills "Preference" feature

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri May 6 05:23:37 EDT 2011



           Summary: "Remove Previous Version.." likely kills "Preference"
    Classification: Mono
           Product: MonoDroid
           Version: unspecified
          Platform: Other
        OS/Version: Windows 7
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Tools
        AssignedTo: mkestner at novell.com
        ReportedBy: aenomoto at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

We cannot keep preference values that are set via PreferenceManager in the
development cycles. This means, PreferenceManager is practically useless.

With the example repro below:

using System;

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Preferences;
using Android.Util;

namespace MonoAndroidApplication1
    [Activity(Label = "MonoAndroidApplication1", MainLauncher = true, Icon =
    public class Activity1 : Activity
        int count = 1;

        protected override void OnCreate(Bundle bundle)

            // Set our view from the "main" layout resource

            var p = PreferenceManager.GetDefaultSharedPreferences (this);
            Log.Debug ("TEST", p.GetString ("test", "ZAPZAPZAP"));
            var ed = p.Edit ();
            ed.PutString ("test", "testvalue");
            ed.Commit ();
            Log.Debug("TEST", p.GetString("test", "ZAPZAPZAP"));

At initial run, we get:

D/TEST    ( 8698): ZAPZAPZAP
D/TEST    ( 8698): testvalue

shut down the app and restart it. It successfully prints:

D/TEST    ( 8769): testvalue
D/TEST    ( 8769): testvalue

So, preference is saved. But retry it after making some changes in the app:

D/TEST    ( 8769): ZAPZAPZAP
D/TEST    ( 8769): testvalue

It's again blank. Of course, this time it also saves the preference. So if you
run it again, then it successfully prints:

D/TEST    ( 8769): testvalue
D/TEST    ( 8769): testvalue

I guess "Removing Previous Version.." is bad. Everry time we make changes and
transmits the app to the emu or the device, it tries to remove previous version
that likely kills the preference values too. Is there any reason for the
explicit removal?

I tried the same on Eclipse and it just worked.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list