+ public static CreateBookmarkFolderDialog createBookmarkFolder(Bitmap favoriteIconBitmap) {
+ // Create a favorite icon byte array output stream.
+ ByteArrayOutputStream favoriteIconByteArrayOutputStream = new ByteArrayOutputStream();
+
+ // Convert the favorite icon to a PNG and place it in the byte array output stream. `0` is for lossless compression (the only option for a PNG).
+ favoriteIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, favoriteIconByteArrayOutputStream);
+
+ // Convert the byte array output stream to a byte array.
+ byte[] favoriteIconByteArray = favoriteIconByteArrayOutputStream.toByteArray();
+
+ // Create an arguments bundle.
+ Bundle argumentsBundle = new Bundle();
+
+ // Store the favorite icon in the bundle.
+ argumentsBundle.putByteArray("favorite_icon_byte_array", favoriteIconByteArray);
+
+ // Create a new instance of the dialog.
+ CreateBookmarkFolderDialog createBookmarkFolderDialog = new CreateBookmarkFolderDialog();
+
+ // Add the bundle to the dialog.
+ createBookmarkFolderDialog.setArguments(argumentsBundle);
+
+ // Return the new dialog.
+ return createBookmarkFolderDialog;
+ }
+