Source:
<code>public void appendMediaFile(final MediaFile mediaFile, final String mediaUrl, ImageLoader imageLoader) { final String safeMediaUrl = Utils.escapeQuotes(mediaUrl); if (URLUtil.isNetworkUrl(mediaUrl)) { if (mediaFile.isVideo()) { ToastUtils.showToast(getActivity(), R.string.media_insert_unimplemented); } else { ToastUtils.showToast(getActivity(), R.string.media_insert_unimplemented); } mActionStartedAt = System.currentTimeMillis(); } else { String localMediaId = String.valueOf(mediaFile.getId()); if (mediaFile.isVideo()) { ToastUtils.showToast(getActivity(), R.string.media_insert_unimplemented); } else { AttributesImpl attrs = new AttributesImpl(); attrs.addAttribute("", "data-wpid", "data-wpid", "string", localMediaId); attrs.addAttribute("", "src", "src", "string", safeMediaUrl); int maxWidth = DisplayUtils.getDisplayPixelWidth(getActivity()); Bitmap bitmapToShow = ImageUtils.getWPImageSpanThumbnailFromFilePath(getActivity(), safeMediaUrl, maxWidth); if (bitmapToShow == null) { ToastUtils.showToast(getActivity(), R.string.error_media_load); try { <START> bitmapToShow = BitmapFactory.decodeResource(getResources(), R.drawable.media_image_placeholder); <END> } catch (OutOfMemoryError e) { } } content.insertMedia(new BitmapDrawable(getResources(), bitmapToShow), attrs); content.setOverlay(ImagePredicate.localMediaIdPredicate(localMediaId), 0, new ColorDrawable(getResources().getColor(R.color.media_shade_overlay_color)), Gravity.FILL, attrs); Drawable progressDrawable = getResources().getDrawable(android.R.drawable.progress_horizontal); progressDrawable.setBounds(0, 0, 0, 4); content.setOverlay(ImagePredicate.localMediaIdPredicate(localMediaId), 1, progressDrawable, Gravity.FILL_HORIZONTAL | Gravity.TOP, attrs); content.refreshText(); mUploadingMedia.put(localMediaId, MediaType.IMAGE); } } }</code><technical_language>exception handler necessary Bitmap.decodeResource() catches exceptions. is a chance, however, Bitmap.decodeResource() return null want handle that</technical_language>

Target:
public void appendMediaFile(final MediaFile mediaFile, final String mediaUrl, ImageLoader imageLoader) { final String safeMediaUrl = Utils.escapeQuotes(mediaUrl); if (URLUtil.isNetworkUrl(mediaUrl)) { if (mediaFile.isVideo()) { ToastUtils.showToast(getActivity(), R.string.media_insert_unimplemented); } else { ToastUtils.showToast(getActivity(), R.string.media_insert_unimplemented); } mActionStartedAt = System.currentTimeMillis(); } else { String localMediaId = String.valueOf(mediaFile.getId()); if (mediaFile.isVideo()) { ToastUtils.showToast(getActivity(), R.string.media_insert_unimplemented); } else { AttributesImpl attrs = new AttributesImpl(); attrs.addAttribute("", "data-wpid", "data-wpid", "string", localMediaId); attrs.addAttribute("", "src", "src", "string", safeMediaUrl); int maxWidth = DisplayUtils.getDisplayPixelWidth(getActivity()); Bitmap bitmapToShow = ImageUtils.getWPImageSpanThumbnailFromFilePath(getActivity(), safeMediaUrl, maxWidth); if (bitmapToShow != null) { content.insertMedia(new BitmapDrawable(getResources(), bitmapToShow), attrs); } else { ToastUtils.showToast(getActivity(), R.string.error_media_load); Drawable d = getResources().getDrawable(R.drawable.ic_gridicons_image); d.setBounds(0, 0, maxWidth, maxWidth); content.insertMedia(d, attrs); } content.setOverlay(ImagePredicate.localMediaIdPredicate(localMediaId), 0, new ColorDrawable(getResources().getColor(R.color.media_shade_overlay_color)), Gravity.FILL, attrs); Drawable progressDrawable = getResources().getDrawable(android.R.drawable.progress_horizontal); progressDrawable.setBounds(0, 0, 0, 4); content.setOverlay(ImagePredicate.localMediaIdPredicate(localMediaId), 1, progressDrawable, Gravity.FILL_HORIZONTAL | Gravity.TOP, attrs); content.refreshText(); mUploadingMedia.put(localMediaId, MediaType.IMAGE); } } }