- val bookmarkNameString = createBookmarkNameEditText.text.toString()
- val bookmarkUrlString = createBookmarkUrlEditText.text.toString()
+ val bookmarkNameString = bookmarkNameEditText.text.toString()
+ val bookmarkUrlString = bookmarkUrlEditText.text.toString()
+
+ // Get the selected favorite icon drawable.
+ val favoriteIconDrawable = if (webpageFavoriteIconRadioButton.isChecked) // Use the webpage favorite icon.
+ webpageFavoriteIconImageView.drawable
+ else // Use the custom icon.
+ customIconImageView.drawable
+
+ // Cast the favorite icon bitmap to a bitmap drawable
+ val favoriteIconBitmapDrawable = favoriteIconDrawable as BitmapDrawable
+
+ // Convert the favorite icon bitmap drawable to a bitmap.
+ val favoriteIconBitmap = favoriteIconBitmapDrawable.bitmap