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:it.mb.whatshare.MainActivity.java
private void onTellFriendsSelected() { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/html"); intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject)); intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(getResources().getString(R.string.email_body))); startActivity(Intent.createChooser(intent, getResources().getString(R.string.email_intent_msg))); }
From source file:com.agustinprats.myhrv.MainActivity.java
protected void sendFileByEmail(File file) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "eladfein@gmail.com" }); intent.putExtra(Intent.EXTRA_SUBJECT, "Testing result of HRV bluetooth monitor"); intent.putExtra(Intent.EXTRA_TEXT, "see files attached"); Uri uri = Uri.fromFile(file);// w w w. j a v a 2 s . co m intent.putExtra(Intent.EXTRA_STREAM, uri); startActivity(Intent.createChooser(intent, "Send email...")); }
From source file:com.matthewmitchell.peercoin_android_wallet.ui.WalletActivity.java
public void handleExportTransactions() { // Create CSV file from transactions final File file = new File(Constants.Files.EXTERNAL_WALLET_BACKUP_DIR, Constants.Files.TX_EXPORT_NAME + "-" + getFileDate() + ".csv"); try {/*from www . j a v a 2 s .c om*/ final BufferedWriter writer = new BufferedWriter(new FileWriter(file)); writer.append("Date,Label,Amount (" + MonetaryFormat.CODE_PPC + "),Fee (" + MonetaryFormat.CODE_PPC + "),Address,Transaction Hash,Confirmations\n"); if (txListAdapter == null || txListAdapter.transactions.isEmpty()) { longToast(R.string.export_transactions_mail_intent_failed); log.error("exporting transactions failed"); return; } final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm z"); dateFormat.setTimeZone(TimeZone.getDefault()); for (Transaction tx : txListAdapter.transactions) { TransactionsListAdapter.TransactionCacheEntry txCache = txListAdapter.getTxCache(tx); String memo = tx.getMemo() == null ? "" : StringEscapeUtils.escapeCsv(tx.getMemo()); String fee = tx.getFee() == null ? "" : tx.getFee().toPlainString(); String address = txCache.address == null ? getString(R.string.export_transactions_unknown) : txCache.address.toString(); writer.append(dateFormat.format(tx.getUpdateTime()) + ","); writer.append(memo + ","); writer.append(txCache.value.toPlainString() + ","); writer.append(fee + ","); writer.append(address + ","); writer.append(tx.getHash().toString() + ","); writer.append(tx.getConfidence().getDepthInBlocks() + "\n"); } writer.flush(); writer.close(); } catch (IOException x) { longToast(R.string.export_transactions_mail_intent_failed); log.error("exporting transactions failed", x); return; } final DialogBuilder dialog = new DialogBuilder(this); dialog.setMessage(Html.fromHtml(getString(R.string.export_transactions_dialog_success, file))); dialog.setPositiveButton(WholeStringBuilder.bold(getString(R.string.export_keys_dialog_button_archive)), new OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { final Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.export_transactions_mail_subject)); intent.putExtra(Intent.EXTRA_TEXT, makeEmailText(getString(R.string.export_transactions_mail_text))); intent.setType(Constants.MIMETYPE_TX_EXPORT); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); try { startActivity(Intent.createChooser(intent, getString(R.string.export_transactions_mail_intent_chooser))); log.info("invoked chooser for exporting transactions"); } catch (final Exception x) { longToast(R.string.export_transactions_mail_intent_failed); log.error("exporting transactions failed", x); } } }); dialog.setNegativeButton(R.string.button_dismiss, null); dialog.show(); }
From source file:com.dwdesign.tweetings.fragment.ConversationFragment.java
public void linkGenerationComplete(String url) { if (isShare == false) { final Intent intent = new Intent(INTENT_ACTION_COMPOSE); final Bundle bundle = new Bundle(); bundle.putLong(INTENT_KEY_ACCOUNT_ID, account_id); bundle.putString(INTENT_KEY_TEXT, url); intent.putExtras(bundle);/*w w w .j av a 2s . c o m*/ startActivity(intent); } else { final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, url); startActivity(Intent.createChooser(intent, getString(R.string.share))); } }
From source file:com.support.android.designlibdemo.activities.CampaignDetailActivity.java
public void setupShareIntent() { // Fetch Bitmap Uri locally ImageView ivImage = (ImageView) findViewById(R.id.ivCampaighnImage); // Get access to the URI for the bitmap Uri bmpUri = getLocalBitmapUri(ivImage); if (bmpUri != null) { // Construct a ShareIntent with link to image Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri); shareIntent.putExtra(Intent.EXTRA_SUBJECT, campaign.getTitle()); shareIntent.putExtra(Intent.EXTRA_TEXT, campaign.getCampaignUrl()); shareIntent.setType("image/*"); // Launch sharing dialog for image startActivity(Intent.createChooser(shareIntent, "send")); } else {//from w w w . jav a 2s.c o m Toast.makeText(this, "Some error occured during sharing", Toast.LENGTH_LONG).show(); } }
From source file:com.z.stproperty.PropertyDetail.java
/** * User can share this property details with their friends through email as well * and can choose other options like whats-app, drop-box etc as well *///w ww. j a va 2 s .c o m private void shareWithEmail() { try { String path = Images.Media.insertImage(getContentResolver(), SharedFunction.loadBitmap(shareImageLink), "title", null); Uri screenshotUri = Uri.parse(path); String shareContent = title + "\n\n" + prurl + "\n\n" + price + "\n\n"; Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("image/png"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "" }); intent.putExtra(Intent.EXTRA_SUBJECT, "Property to share with you"); intent.putExtra(Intent.EXTRA_TEXT, "I think you might be interested in a property advertised on STProperty \n\n" + shareContent); intent.putExtra(Intent.EXTRA_STREAM, screenshotUri); SharedFunction.postAnalytics(PropertyDetail.this, "Lead", "Email Share", title); startActivity(Intent.createChooser(intent, "")); } catch (Exception e) { Log.e(this.getClass().getSimpleName(), e.getLocalizedMessage(), e); } }
From source file:com.antew.redditinpictures.library.ui.ImageViewerActivity.java
/** * Handler for when the user selects an item from the ActionBar. * <p>//w w w . j a v a 2 s . c o m * The default functionality implements:<br> * - Toggling the swipe lock on the ViewPager via toggleViewPagerLock()<br> * - Sharing the post via the Android ACTION_SEND intent, the URL shared is provided by * subclasses via {@link #getUrlForSharing()}<br> * - Viewing the post in a Web browser (the URL is provided by subclasses from * {@link #getPostUri()} <br> * - Displaying a dialog to get the filename to use when saving an image, subclasses will * implement {@link #onFinishSaveImageDialog(String)} * </p> */ @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: EasyTracker.getInstance(this) .send(MapBuilder.createEvent(Constants.Analytics.Category.ACTION_BAR_ACTION, Constants.Analytics.Action.HOME, null, null).build()); finish(); return true; case R.id.lock_viewpager: if (mPager.isSwipingEnabled()) { EasyTracker.getInstance(this) .send(MapBuilder.createEvent(Constants.Analytics.Category.ACTION_BAR_ACTION, Constants.Analytics.Action.TOGGLE_SWIPING, Constants.Analytics.Label.DISABLED, null) .build()); } else { EasyTracker.getInstance(this) .send(MapBuilder.createEvent(Constants.Analytics.Category.ACTION_BAR_ACTION, Constants.Analytics.Action.TOGGLE_SWIPING, Constants.Analytics.Label.ENABLED, null) .build()); } // Lock or unlock swiping in the ViewPager setSwipingState(!mPager.isSwipingEnabled(), true); return true; case R.id.share_post: EasyTracker.getInstance(this) .send(MapBuilder.createEvent(Constants.Analytics.Category.ACTION_BAR_ACTION, Constants.Analytics.Action.SHARE_POST, getSubreddit(), null).build()); String subject = getString(R.string.check_out_this_image); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, subject + " " + getUrlForSharing()); startActivity(Intent.createChooser(intent, getString(R.string.share_using_))); return true; case R.id.view_post: EasyTracker .getInstance(this).send( MapBuilder .createEvent(Constants.Analytics.Category.ACTION_BAR_ACTION, Constants.Analytics.Action.OPEN_POST_EXTERNAL, getSubreddit(), null) .build()); Intent browserIntent = new Intent(Intent.ACTION_VIEW, getPostUri()); startActivity(browserIntent); return true; case R.id.save_post: EasyTracker.getInstance(this) .send(MapBuilder.createEvent(Constants.Analytics.Category.ACTION_BAR_ACTION, Constants.Analytics.Action.SAVE_POST, getSubreddit(), null).build()); handleSaveImage(); return true; case R.id.report_image: EasyTracker.getInstance(this) .send(MapBuilder.createEvent(Constants.Analytics.Category.ACTION_BAR_ACTION, Constants.Analytics.Action.REPORT_POST, getSubreddit(), null).build()); new Thread(new Runnable() { @Override public void run() { reportCurrentItem(); } }).start(); Toast.makeText(this, R.string.image_display_issue_reported, Toast.LENGTH_LONG).show(); return true; default: return false; } }
From source file:nl.sogeti.android.gpstracker.actions.ShareTrack.java
private void sendFile(Uri fileUri, String body, String contentType) { Intent sendActionIntent = new Intent(Intent.ACTION_SEND); sendActionIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.email_subject)); sendActionIntent.putExtra(Intent.EXTRA_TEXT, body); sendActionIntent.putExtra(Intent.EXTRA_STREAM, fileUri); sendActionIntent.setType(contentType); startActivity(Intent.createChooser(sendActionIntent, getString(R.string.sender_chooser))); }