private void shareAction() throws Exception { String form = sectionObject.toString(); float lat = (float) latitude; float lon = (float) longitude; String osmUrl = Utilities.osmUrlFromLatLong(lat, lon, true, false); // double altim = note.getAltim(); List<String> imagePaths = FormUtilities.getImages(form); File imageFile = null; if (imagePaths.size() > 0) { String imagePath = imagePaths.get(0); imageFile = new File(imagePath); if (!imageFile.exists()) { imageFile = null; } } String formText = FormUtilities.formToPlainText(form, false); formText = formText + "\n" + osmUrl; String shareNoteMsg = getResources().getString(R.string.share_note_with); if (imageFile != null) { ShareUtilities.shareTextAndImage(this, shareNoteMsg, formText, imageFile); } else { ShareUtilities.shareText(this, shareNoteMsg, formText); } }