List of usage examples for android.content Intent EXTRA_TEXT
String EXTRA_TEXT
To view the source code for android.content Intent EXTRA_TEXT.
Click Source Link
From source file:me.piebridge.bible.Bible.java
public void email(Context context, String content) { StringBuffer subject = new StringBuffer(); subject.append(context.getString(R.string.app_name)); if (versionName != null) { subject.append(" "); subject.append(versionName);/*from www. j ava 2 s. com*/ } subject.append("(Android "); subject.append(Locale.getDefault().toString()); subject.append("-"); subject.append(Build.VERSION.RELEASE); subject.append(")"); Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:liudongmiao@gmail.com")); intent.putExtra(Intent.EXTRA_SUBJECT, subject.toString()); if (content != null) { intent.putExtra(Intent.EXTRA_TEXT, content); } try { context.startActivity(intent); } catch (ActivityNotFoundException e) { } }
From source file:com.kncwallet.wallet.ui.WalletActivity.java
private void mailPrivateKeys(@Nonnull final File file) { final Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.export_keys_dialog_mail_subject)); intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.export_keys_dialog_mail_text) + "\n\n" + String.format(Constants.WEBMARKET_APP_URL, getPackageName()) + "\n\n" + Constants.SOURCE_URL + '\n'); intent.setType("x-bitcoin/private-keys"); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); startActivity(Intent.createChooser(intent, getString(R.string.export_keys_dialog_mail_intent_chooser))); log.info("invoked archive private keys chooser"); }
From source file:com.edible.ocr.CaptureActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { ClipboardManager clipboardManager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); switch (item.getItemId()) { case OPTIONS_COPY_RECOGNIZED_TEXT_ID: clipboardManager.setText(ocrResultView.getText()); if (clipboardManager.hasText()) { Toast toast = Toast.makeText(this, "Text copied.", Toast.LENGTH_LONG); toast.setGravity(Gravity.BOTTOM, 0, 0); toast.show();/*from w w w . j a v a 2 s .co m*/ } return true; case OPTIONS_SHARE_RECOGNIZED_TEXT_ID: Intent shareRecognizedTextIntent = new Intent(android.content.Intent.ACTION_SEND); shareRecognizedTextIntent.setType("text/plain"); shareRecognizedTextIntent.putExtra(android.content.Intent.EXTRA_TEXT, ocrResultView.getText()); startActivity(Intent.createChooser(shareRecognizedTextIntent, "Share via")); return true; case OPTIONS_COPY_TRANSLATED_TEXT_ID: clipboardManager.setText(translationView.getText()); if (clipboardManager.hasText()) { Toast toast = Toast.makeText(this, "Text copied.", Toast.LENGTH_LONG); toast.setGravity(Gravity.BOTTOM, 0, 0); toast.show(); } return true; case OPTIONS_SHARE_TRANSLATED_TEXT_ID: Intent shareTranslatedTextIntent = new Intent(android.content.Intent.ACTION_SEND); shareTranslatedTextIntent.setType("text/plain"); shareTranslatedTextIntent.putExtra(android.content.Intent.EXTRA_TEXT, translationView.getText()); startActivity(Intent.createChooser(shareTranslatedTextIntent, "Share via")); return true; default: return super.onContextItemSelected(item); } }
From source file:com.lgallardo.qbittorrentclient.RefreshListener.java
public void emailReport() { if (CustomLogger.isMainActivityReporting()) { Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setType("text/plain"); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "lgallard+qbcontroller@gmail.com" }); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "qBittorrentController report"); // Include report emailIntent.putExtra(Intent.EXTRA_TEXT, CustomLogger.getReport()); // Delete report CustomLogger.setMainActivityReporting(false); CustomLogger.deleteMainReport(); CustomLogger.deleteNotifierReport(); // Launch email chooser startActivity(Intent.createChooser(emailIntent, "Send qBittorrent report...")); // Reporting - Finish report CustomLogger.setMainActivityReporting(false); }//from w w w .ja v a 2s. com }
From source file:de.vanita5.twittnuker.util.Utils.java
public static Intent createStatusShareIntent(final Context context, final ParcelableStatus status) { final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); final String name = status.user_name, screenName = status.user_screen_name; final String timeString = formatToLongTimeString(context, status.timestamp); final String subject = context.getString(R.string.share_subject_format, name, screenName, timeString); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, status.text_plain); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); return intent; }
From source file:com.saulcintero.moveon.fragments.History.java
public static void sendAction(final Activity act, int[] idList, String[] nameList, String[] activityList, String[] shortDescriptionList, String[] longDescriptionList) { ArrayList<Integer> positions = new ArrayList<Integer>(); for (int p = 0; p < idList.length; p++) { String nameToSearch = osmFilesNameFromUploadPosition.get(p).substring(0, osmFilesNameFromUploadPosition.get(p).length() - 4); positions.add(ArrayUtils.indexOf(listOfFiles, nameToSearch)); }//from ww w . ja va 2s .c o m for (int j = 0; j < idList.length; j++) { final String name = nameList[j]; final String activity = activityList[j]; final String shortDescription = shortDescriptionList[j]; final String longDescription = longDescriptionList[j]; final String url = osmUrlsToShare.get(positions.get(j)); Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND); sendIntent.setType("text/plain"); List<ResolveInfo> activities = act.getPackageManager().queryIntentActivities(sendIntent, 0); AlertDialog.Builder builder = new AlertDialog.Builder(act); builder.setTitle(act.getText(R.string.send_to) + " " + name + " " + act.getText(R.string.share_with)); final ShareIntentListAdapter adapter = new ShareIntentListAdapter(act, R.layout.social_share, activities.toArray()); builder.setAdapter(adapter, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ResolveInfo info = (ResolveInfo) adapter.getItem(which); if (info.activityInfo.packageName.contains("facebook")) { Intent i = new Intent("android.intent.action.PUBLISH_TO_FB_WALL"); i.putExtra("name", activity + " " + name); i.putExtra("msg", String.format("%s", shortDescription)); i.putExtra("link", String.format("%s", url)); act.sendBroadcast(i); } else { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setClassName(info.activityInfo.packageName, info.activityInfo.name); intent.setType("text/plain"); if ((info.activityInfo.packageName.contains("twitter")) || (info.activityInfo.packageName.contains("sms")) || (info.activityInfo.packageName.contains("mms"))) { intent.putExtra(Intent.EXTRA_TEXT, shortDescription + url); } else { intent.putExtra(Intent.EXTRA_TEXT, longDescription + url); } act.startActivity(intent); } } }); builder.create().show(); } }
From source file:com.androzic.MapFragment.java
@Override public boolean onMenuItemSelected(MenuBuilder builder, MenuItem item) { switch (item.getItemId()) { case R.id.action_information: { FragmentManager manager = getFragmentManager(); LocationInfo dialog = new LocationInfo(application.getMapCenter()); dialog.show(manager, "dialog"); return true; }//from ww w . j av a 2 s. c o m case R.id.action_share: { Intent i = new Intent(android.content.Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_SUBJECT, R.string.currentloc); double[] loc = application.getMapCenter(); String spos = StringFormatter.coordinates(" ", loc[0], loc[1]); i.putExtra(Intent.EXTRA_TEXT, spos); startActivity(Intent.createChooser(i, getString(R.string.menu_share))); return true; } case R.id.action_view_elsewhere: { double[] sloc = application.getMapCenter(); String geoUri = "geo:" + Double.toString(sloc[0]) + "," + Double.toString(sloc[1]); Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(geoUri)); startActivity(intent); return true; } case R.id.action_copy_location: { double[] cloc = application.getMapCenter(); String cpos = StringFormatter.coordinates(" ", cloc[0], cloc[1]); Clipboard.copy(getActivity(), cpos); return true; } case R.id.action_paste_location: { String text = Clipboard.paste(getActivity()); try { double c[] = CoordinateParser.parse(text); if (!Double.isNaN(c[0]) && !Double.isNaN(c[1])) { boolean mapChanged = application.setMapCenter(c[0], c[1], true, true, false); if (mapChanged) map.updateMapInfo(); map.updateMapCenter(); following = false; map.setFollowing(false); } } catch (IllegalArgumentException e) { } return true; } case R.id.action_add_to_route: { Waypoint wpt = application.getWaypoint(waypointSelected); application.routeEditingWaypoints .push(application.editingRoute.addWaypoint(wpt.name, wpt.latitude, wpt.longitude)); refreshMap(); return true; } case R.id.action_navigate: { application.navigationService.setRouteWaypoint(waypointSelected); return true; } case R.id.action_mapobject_navigate: { application.startNavigation(application.getMapObject(mapObjectSelected)); return true; } } return false; }
From source file:activities.PaintActivity.java
private void invokeApplication(String packageName, Resources resources) { int requestCode = 0; Log.d("DialogShare", "Seleccionado ... " + packageName); Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.setType("image/*"); shareIntent.setPackage(packageName); //Image/* w ww .j a va 2 s .c o m*/ Bitmap bitmap = painter.getImageBitmap(); if ((uriTempImage = PaintUtility.saveTempPhoto(this, bitmap)) == null) Toast.makeText(this, "Error al crear imagonen ", Toast.LENGTH_SHORT).show(); shareIntent.putExtra(Intent.EXTRA_STREAM, uriTempImage); if (packageName.contains("twitter")) { shareIntent.putExtra(Intent.EXTRA_TEXT, resources.getString(string.sharecontent_twitter_text)); requestCode = RS_CODE_SHARE_TWITTER; } else if (packageName.contains("facebook")) { // Warning: Facebook IGNORES our text. They say "These fields are intended for users to express themselves. Pre-filling these fields erodes the authenticity of the user voice." // One workaround is to use the Facebook SDK to post, but that doesn't allow the user to choose how they want to share. We can also make a custom landing page, and the link // will show the <meta content ="..."> text from that page with our link in Facebook. shareIntent.putExtra(Intent.EXTRA_TEXT, resources.getString(string.sharecontent_fb_text)); requestCode = RS_CODE_SHARE_FB; } else if (packageName.contains("gm")) { shareIntent.putExtra(Intent.EXTRA_TEXT, resources.getString(string.sharecontent_email_text)); shareIntent.putExtra(Intent.EXTRA_SUBJECT, resources.getString(string.sharecontent_subject)); shareIntent.setType("message/rfc822"); requestCode = RS_CODE_SHARE_GMAIL; } startActivityForResult(shareIntent, requestCode); }
From source file:org.getlantern.firetweet.util.Utils.java
public static Intent createStatusShareIntent(final Context context, final ParcelableStatus status) { final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, getStatusShareSubject(context, status)); intent.putExtra(Intent.EXTRA_TEXT, getStatusShareText(context, status)); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); return intent; }