Forum Xamarin.Forms

Error when using Settings plugin in android xamarin forms

PiratePirate SAMember ✭✭

Hi ,

I am building xamarin forms app , I tried to use jamesmontemagno settings plugin in shared project and it works fine in IOS but in android it gives below error . Has anyone encounter this error before ?

System.NullReferenceException: Object reference not set to an instance of an object at Plugin.Settings.SettingsImplementation.GetValueOrDefaultCore[T] (ISharedPreferences sharedPreferences, System.String key, Plugin.Settings.T defaultValue) [0x0030d] in <filename unknown>:0 at Plugin.Settings.SettingsImplementation.GetValueOrDefault[T] (System.String key, Plugin.Settings.T defaultValue) [0x0001c] in <filename unknown>:0 at AgeCalcForms.Settings.get_PageBackgroundColor () [0x00010] in /Users/Pirate/Projects/Forms/AgeCalcForms/AgeCalcForms/Helpers/AppSettings.cs:92 at AgeCalcForms.PersonItemPage1..ctor (AgeCalcForms.Person item) [0x0001e] in /Users/Pirate/Projects/Forms/AgeCalcForms/AgeCalcForms/Views/PersonItemPage1.cs:26 at AgeCalcForms.PersonListPage.<PersonListPage>m__0 (System.Object sender, Xamarin.Forms.SelectedItemChangedEventArgs e) [0x0001f] in /Users/Pirate/Projects/Forms/AgeCalcForms/AgeCalcForms/Views/PersonListPage.cs:45 at at (wrapper delegate-invoke) System.EventHandler1[Xamarin.Forms.SelectedItemChangedEventArgs]:invoke_void_object_TEventArgs (object,Xamarin.Forms.SelectedItemChangedEventArgs)
at Xamarin.Forms.ListView.OnSelectedItemChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x0001c] in :0
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindablePropertyContext context, System.Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent) [0x00112] in :0
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes) [0x001f3] in :0
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, SetValueFlags attributes) [0x00000] in :0
at Xamarin.Forms.ListView.NotifyRowTapped (Int32 groupIndex, Int32 inGroupIndex) [0x00048] in :0
at Xamarin.Forms.ListView.NotifyRowTapped (Int32 index) [0x00022] in :0
at Xamarin.Forms.Platform.Android.ListViewAdapter.OnItemClick (Android.Widget.AdapterView parent, Android.Views.View view, Int32 position, Int64 id) [0x0000f] in :0
at Android.Widget.AdapterView+IOnItemClickListenerInvoker.n_OnItemClick_Landroid_widget_AdapterView_Landroid_view_View_IJ (IntPtr jnienv, IntPtr native__this, IntPtr native_parent, IntPtr native_view, Int32 position, Int64 id) [0x00019] in /Users/builder/data/lanes/2970/46c3f7e0/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Widget.AdapterView.cs:212
at at (wrapper dynamic-method) System.Object:2a9b13db-55b3-4b6a-9bba-9a958bceb472 (intptr,intptr,intptr,intptr,int,long)
`

Answers

  • PiratePirate SAMember ✭✭

    I just realized it only support for: Int, Int64, Double, String, DateTime, Bool, Float, Decimal, Guid . I was using it to get Color property . So do I have to do more work to get Color supported as well ??

Sign In or Register to comment.