- // Get a `Bitmap` of the favorite icon from `MainWebViewActivity` and display it in `edit_folder_web_page_favorite_icon`.
- ImageView webPageFavoriteIconImageView = alertDialog.findViewById(R.id.edit_folder_web_page_favorite_icon_imageview);
- webPageFavoriteIconImageView.setImageBitmap(MainWebViewActivity.favoriteIconBitmap);
+ // Get a copy of the favorite icon bitmap.
+ Bitmap favoriteIconBitmap = MainWebViewActivity.favoriteIconBitmap;
+
+ // Scale the favorite icon bitmap down if it is larger than 256 x 256. Filtering uses bilinear interpolation.
+ if ((favoriteIconBitmap.getHeight() > 256) || (favoriteIconBitmap.getWidth() > 256)) {
+ favoriteIconBitmap = Bitmap.createScaledBitmap(favoriteIconBitmap, 256, 256, true);
+ }
+
+ // Set the new favorite icon bitmap.
+ webPageFavoriteIconImageView.setImageBitmap(favoriteIconBitmap);