Forum Xamarin Xamarin.Android

Handling savefiles in xamarin for android

Hello everyone :) recently I've started developing an app for Android using Xamarin (obviously).
One thing I have just not been able to find out, is how to handle savefiles; just a sheet with, for example, ten integers that can be changed by the code, can be used in code as integers, and so on. Moreso, I have looked at plenty of examples on how to write files (just a simple .txt) but none of those even worked. If anyone could shed some light on the most used practice for saving just a few values, and how to acces them from inside the OnCreate() method from the MainActivity, that would be totally awesome :D

Best Answers


  • MrBobJamesBobMrBobJamesBob NLMember

    Thanks sir Cheesebaron for your answer! I will definitely checkout the plugin, but if I may ask, what exactly does the "using" word. I've seen it around but don't really know yet what to use it for and what it means :)

  • MrBobJamesBobMrBobJamesBob NLMember

    'using (var sharedPrefs = PreferenceManager.GetDefaultSharedPreferences(context))'
    gives me an error: the name context doesn't exist. I've tried changing it to 'Context' or 'Context context', but neither work

  • CheesebaronCheesebaron DKInsider, University mod

    If you are calling this inside your Activity then context in this case is simply this.

Sign In or Register to comment.