Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android invoke interface method failed #5

Open
jvhgamer opened this issue Apr 16, 2019 · 0 comments
Open

Android invoke interface method failed #5

jvhgamer opened this issue Apr 16, 2019 · 0 comments

Comments

@jvhgamer
Copy link

jvhgamer commented Apr 16, 2019

Java.Lang.NullPointerException: Attempt to invoke interface method 'int java.lang.CharSequence.length()' on a null object reference

Implementation

        public SuperRabbit.Lib.WheelPicker pickerViewModel;
        pickerViewModel = new SuperRabbit.Lib.WheelPicker(Droid.MainActivity._Instance);

        List<object> listDigits = new List<object> {
                "0", "1", "2", "3", "4",
                "5", "6", "7", "8", "9"
        };
        pickerViewModel.SetAdapter(new CustomWheelAdapter(listDigits));

        StackLayout stack = new StackLayout();
        stack.Children.Add(pickerViewModel);
        grid.Children.Add(stack, 0, 0);

        Content = grid;

WheelAdapter class

        public class CustomWheelAdapter : 
            Java.Lang.Object, Android.Support.V7.View.ActionMode.ICallback, SuperRabbit.Lib.IWheelAdapter
        {
            public CustomWheelAdapter(List<object> list)
            {
                ListItems = list;
            }

            public List<object> ListItems { get; set; }

            public int MaxIndex { get; set; }

            public int MinIndex { get; set; }

            public string TextWithMaximumLength { get; set; }

            public int GetPosition(string value)
            {
                return 0;
            }

            public string GetValue(int position)
            {
                return string.Empty;
                //Console.WriteLine("GetValue(); pos:" + position);
                //if (ListItems != null && ListItems.Count >= position)
                //    return ListItems.ElementAt(position).ToString();
                //else
                //    return string.Empty;
            }

            bool Android.Support.V7.View.ActionMode.ICallback.OnActionItemClicked(Android.Support.V7.View.ActionMode mode, IMenuItem item)
            {
                throw new NotImplementedException();
            }

            bool Android.Support.V7.View.ActionMode.ICallback.OnCreateActionMode(Android.Support.V7.View.ActionMode mode, IMenu menu)
            {
                throw new NotImplementedException();
            }

            void Android.Support.V7.View.ActionMode.ICallback.OnDestroyActionMode(Android.Support.V7.View.ActionMode mode)
            {
                throw new NotImplementedException();
            }

            bool Android.Support.V7.View.ActionMode.ICallback.OnPrepareActionMode(Android.Support.V7.View.ActionMode mode, IMenu menu)
            {
                throw new NotImplementedException();
            }
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant