Beispiel #1
0
 private void BuildMultiChoice(Builder builder)
 {
     builder.SetItems(PrepareAdapter(Resource.Layout.sdl_list_item_multichoice), AsIntArray(CheckedItems), Android.Widget.ChoiceMode.Multiple, (sender, e) =>
     {
         SparseBooleanArray checkedPositions = ((ListView)e.Parent).CheckedItemPositions;
         CheckedItems = new SparseBooleanArrayParcelable(checkedPositions);
     });
 }
        public Java.Lang.Object CreateFromParcel(Parcel source)
        {
            Console.WriteLine("MyParcelableCreator.CreateFromParcel");
            SparseBooleanArrayParcelable read = new SparseBooleanArrayParcelable();
            int size = source.ReadInt();

            int[]  keys   = new int[size];
            bool[] values = new bool[size];

            source.ReadIntArray(keys);
            source.ReadBooleanArray(values);

            for (int i = 0; i < size; i++)
            {
                read.Put(keys[i], values[i]);
            }

            return(read);
        }
Beispiel #3
0
            protected override Bundle PrepareArguments()
            {
                Bundle args = new Bundle();

                args.PutString(ARG_TITLE, title);
                args.PutString(ARG_POSITIVE_BUTTON, confirmButtonText);
                args.PutString(ARG_NEGATIVE_BUTTON, cancelButtonText);

                args.PutStringArray(ARG_ITEMS, items);

                SparseBooleanArrayParcelable sparseArray = new SparseBooleanArrayParcelable();

                for (int index = 0; checkedItems != null && index < checkedItems.Length; index++)
                {
                    sparseArray.Put(checkedItems[index], true);
                }
                args.PutParcelable(ARG_CHECKED_ITEMS, sparseArray);
                args.PutInt(ARG_MODE, (int)mode);

                return(args);
            }