+ // Set the folder icon according to the type.
+ if (foldersMergeCursor.getPosition() == 0) { // Set the `Home Folder` icon.
+ // Set the gray folder image. `ContextCompat` must be used until the minimum API >= 21.
+ spinnerItemImageView.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.folder_gray));
+ } else { // Set a user folder icon.
+ // Get the folder icon byte array.
+ byte[] folderIconByteArray = cursor.getBlob(cursor.getColumnIndex(BookmarksDatabaseHelper.FAVORITE_ICON));
+
+ // Convert the byte array to a bitmap beginning at the first byte and ending at the last.
+ Bitmap folderIconBitmap = BitmapFactory.decodeByteArray(folderIconByteArray, 0, folderIconByteArray.length);
+
+ // Set the folder icon.
+ spinnerItemImageView.setImageBitmap(folderIconBitmap);
+ }
+
+ // Set the text view to display the folder name.