Quantcast

SharedPreferences

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

SharedPreferences

Scott R. Dahl
Can someone show me an example of reading SharedPreferences in monodroid?  When I import the namespace it only gives me the interface to work with ...

_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SharedPreferences

Liam Houlahan
Here is a quick example from inside an Activity.

Edit shared prefs
ISharedPreferences prefs = GetPreferences (FileCreationMode.Append);
            ISharedPreferencesEditor editor = prefs.Edit ();
            editor.PutBoolean ("ValueName", false);
            editor.Commit ();
 
Get Shared prefs values
ISharedPreferences prefs = GetPreferences (FileCreationMode.Append);
bool valueName = prefs.GetBoolean ("ValueName", true);

If you want to use a preferences activity check out Gregs example here https://github.com/gshackles/Sample-Projects/tree/master/MonoDroid/MonoDroidSamples/MonoDroidSamples/DemoActivities/Preferences

Liam

On 8/05/2011 12:06 p.m., Scott R. Dahl wrote:
Can someone show me an example of reading SharedPreferences in monodroid?  When I import the namespace it only gives me the interface to work with ...
_______________________________________________ Monodroid mailing list [hidden email] UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid

_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SharedPreferences

Atsushi Eno
Yes the code would be like this :)
But see also https://bugzilla.novell.com/show_bug.cgi?id=692215

Atsushi Eno

(2011/05/08 9:11), Liam wrote:

> Here is a quick example from inside an Activity.
>
> Edit shared prefs
> ISharedPreferences prefs = GetPreferences (FileCreationMode.Append);
>             ISharedPreferencesEditor editor = prefs.Edit ();
>             editor.PutBoolean ("ValueName", false);
>             editor.Commit ();
>
> Get Shared prefs values
> ISharedPreferences prefs = GetPreferences (FileCreationMode.Append);
> bool valueName = prefs.GetBoolean ("ValueName", true);
>
> If you want to use a preferences activity check out Gregs example here
> https://github.com/gshackles/Sample-Projects/tree/master/MonoDroid/MonoDroidSamples/MonoDroidSamples/DemoActivities/Preferences
>
> Liam
>
> On 8/05/2011 12:06 p.m., Scott R. Dahl wrote:
>> Can someone show me an example of reading SharedPreferences in
>> monodroid?  When I import the namespace it only gives me the
>> interface to work with ...
>>
>> _______________________________________________
>> Monodroid mailing list
>> [hidden email]  <mailto:[hidden email]>
>>
>> UNSUBSCRIBE INFORMATION:
>> http://lists.ximian.com/mailman/listinfo/monodroid
>
>
> _______________________________________________
> Monodroid mailing list
> [hidden email]
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid

_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Loading...