コード例 #1
0
ファイル: Activity1.cs プロジェクト: kkknet/spikes
        private void CanYouPictureThat()
        {
            string orderBy = CreateCursor();

            Console.WriteLine("Getting column index");
            int image_column_index = _imagecursor.GetColumnIndex(orderBy);

            var count = _imagecursor.Count;

            Console.WriteLine("Found {0} photos", count);

            this.thumbnails = new Bitmap[count];
            var arrPath = new string[count];

            this.thumbnailsselection = new bool[count];

            for (int i = 0; i < count; i++)
            {
                _imagecursor.MoveToPosition(i);
                int id = _imagecursor.GetInt(image_column_index);
                int dataColumnIndex = _imagecursor.GetColumnIndex(MediaStore.Images.Media.InterfaceConsts.Data);

                thumbnails[i] = MediaStore.Images.Thumbnails.GetThumbnail(ApplicationContext.ContentResolver, id, ThumbnailKind.MicroKind, null);
                arrPath[i]    = _imagecursor.GetString(dataColumnIndex);
                if (i % 25 == 0)
                {
                    Console.WriteLine("Processing {0}th photo", i);
                }
            }

            Console.WriteLine("All photos processed, creating image adapter");

            var imageAdapter = new ImageAdapter(this)
            {
                thumbIds = thumbnails
            };

            Console.WriteLine("Assigning adapter to grid view");
            _gridView.Adapter = imageAdapter;

            Console.WriteLine("done");
        }
コード例 #2
0
ファイル: Activity1.cs プロジェクト: adbk/spikes
        private void CanYouPictureThat()
        {
            string orderBy = CreateCursor();

            Console.WriteLine("Getting column index");
            int image_column_index = _imagecursor.GetColumnIndex(orderBy);

            var count = _imagecursor.Count;
            Console.WriteLine("Found {0} photos", count);

            this.thumbnails = new Bitmap[count];
            var arrPath = new string[count];
            this.thumbnailsselection = new bool[count];

            for (int i = 0; i < count; i++)
            {
                _imagecursor.MoveToPosition(i);
                int id = _imagecursor.GetInt(image_column_index);
                int dataColumnIndex = _imagecursor.GetColumnIndex(MediaStore.Images.Media.InterfaceConsts.Data);

                thumbnails[i] = MediaStore.Images.Thumbnails.GetThumbnail(ApplicationContext.ContentResolver, id, ThumbnailKind.MicroKind, null);
                arrPath[i] = _imagecursor.GetString(dataColumnIndex);
                if (i % 25 == 0)
                {
                    Console.WriteLine("Processing {0}th photo", i);
                }
            }

            Console.WriteLine("All photos processed, creating image adapter");

            var imageAdapter = new ImageAdapter(this)
            {
                thumbIds = thumbnails
            };

            Console.WriteLine("Assigning adapter to grid view");
            _gridView.Adapter = imageAdapter;

            Console.WriteLine("done");
        }