Source:
<code>protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); try { if (requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK && null != data) { Cursor cursor = null; Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; try { cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String imgPathString = cursor.getString(columnIndex); File sourceFile = new File(imgPathString); long fileLength = sourceFile.length() / (1024 * 1024); String currentAnkiDroidDirectory = CollectionHelper.getCurrentAnkiDroidDirectory(this); <START> String imageName = "DeckPickerBackground.png"; <END> File destFile = new File(currentAnkiDroidDirectory, imageName); if (fileLength < 10) { try (FileChannel sourceChannel = new FileInputStream(sourceFile).getChannel(); FileChannel destChannel = new FileOutputStream(destFile).getChannel()) { destChannel.transferFrom(sourceChannel, 0, sourceChannel.size()); UIUtils.showThemedToast(this, getString(R.string.background_image_applied), false); } } else { backgroundImage.setChecked(false); UIUtils.showThemedToast(this, getString(R.string.image_max_size_10_mb), false); } } finally { if (cursor != null) { cursor.close(); } } } else { backgroundImage.setChecked(false); UIUtils.showThemedToast(this, getString(R.string.no_image_selected), false); } } catch (OutOfMemoryError | Exception e) { UIUtils.showThemedToast(this, getString(R.string.error_selecting_image, e.getLocalizedMessage()), false); } }</code><technical_language>consider moving this a private static final String variable</technical_language>

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); try { if (requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK && null != data) { Cursor cursor = null; Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; try { cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String imgPathString = cursor.getString(columnIndex); File sourceFile = new File(imgPathString); fileLength = sourceFile.length() / (1024 * 1024); String currentAnkiDroidDirectory = CollectionHelper.getCurrentAnkiDroidDirectory(this); String imageName = "DeckPickerBackground.png"; File destFile = new File(currentAnkiDroidDirectory, imageName); if (fileLength < 10) { try (FileChannel sourceChannel = new FileInputStream(sourceFile).getChannel(); FileChannel destChannel = new FileOutputStream(destFile).getChannel()) { destChannel.transferFrom(sourceChannel, 0, sourceChannel.size()); UIUtils.showThemedToast(this, getString(R.string.background_image_applied), false); } } else { backgroundImage.setChecked(false); UIUtils.showThemedToast(this, getString(R.string.image_max_size_allowed, 10), false); } } finally { if (cursor != null) { cursor.close(); } } } else { backgroundImage.setChecked(false); UIUtils.showThemedToast(this, getString(R.string.no_image_selected), false); } } catch (OutOfMemoryError | Exception e) { UIUtils.showThemedToast(this, getString(R.string.error_selecting_image, e.getLocalizedMessage()), false); } }