List of usage examples for android.content Intent EXTRA_SUBJECT
String EXTRA_SUBJECT
To view the source code for android.content Intent EXTRA_SUBJECT.
Click Source Link
From source file:com.hivewallet.androidclient.wallet.ui.WalletActivity.java
private boolean archiveWalletBackup(@Nonnull final File file) { Uri shareableUri = null;/*ww w . j av a 2s.c o m*/ try { shareableUri = FileProvider.getUriForFile(this, Constants.FILE_PROVIDER_AUTHORITY, file); } catch (IllegalArgumentException e) { throw new RuntimeException("Backup file cannot be shared", e); } log.info("Shareable URI: {}", shareableUri); 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(Constants.MIMETYPE_WALLET_BACKUP); intent.putExtra(Intent.EXTRA_STREAM, shareableUri); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); try { startActivity(Intent.createChooser(intent, getString(R.string.export_keys_dialog_mail_intent_chooser))); log.info("invoked chooser for archiving wallet backup"); return true; } catch (final Exception x) { longToast(R.string.export_keys_dialog_mail_intent_failed); log.error("archiving wallet backup failed", x); return false; } }
From source file:com.nttec.everychan.ui.presentation.BoardFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { //? ? -/* w w w . j ava 2 s . c o m*/ switch (item.getItemId()) { case R.id.context_menu_thumb_load_thumb: bitmapCache.asyncGet( ChanModels.hashAttachmentModel((AttachmentModel) lastContextMenuAttachment.getTag()), ((AttachmentModel) lastContextMenuAttachment.getTag()).thumbnail, resources.getDimensionPixelSize(R.dimen.post_thumbnail_size), chan, null, imagesDownloadTask, (ImageView) lastContextMenuAttachment.findViewById(R.id.post_thumbnail_image), imagesDownloadExecutor, Async.UI_HANDLER, true, R.drawable.thumbnail_error); return true; case R.id.context_menu_thumb_download: downloadFile((AttachmentModel) lastContextMenuAttachment.getTag()); return true; case R.id.context_menu_thumb_copy_url: String url = chan.fixRelativeUrl(((AttachmentModel) lastContextMenuAttachment.getTag()).path); Clipboard.copyText(activity, url); Toast.makeText(activity, resources.getString(R.string.notification_url_copied, url), Toast.LENGTH_LONG) .show(); return true; case R.id.context_menu_thumb_attachment_info: String info = Attachments.getAttachmentInfoString(chan, ((AttachmentModel) lastContextMenuAttachment.getTag()), resources); Toast.makeText(activity, info, Toast.LENGTH_LONG).show(); return true; case R.id.context_menu_thumb_reverse_search: ReverseImageSearch.openDialog(activity, chan.fixRelativeUrl(((AttachmentModel) lastContextMenuAttachment.getTag()).path)); return true; } //? ? ? int position = lastContextMenuPosition; if (item.getMenuInfo() != null && item.getMenuInfo() instanceof AdapterView.AdapterContextMenuInfo) { position = ((AdapterView.AdapterContextMenuInfo) item.getMenuInfo()).position; } if (nullAdapterIsSet || position == -1 || adapter.getCount() <= position) return false; switch (item.getItemId()) { case R.id.context_menu_open_in_new_tab: UrlPageModel modelNewTab = new UrlPageModel(); modelNewTab.chanName = chan.getChanName(); modelNewTab.type = UrlPageModel.TYPE_THREADPAGE; modelNewTab.boardName = tabModel.pageModel.boardName; modelNewTab.threadNumber = adapter.getItem(position).sourceModel.parentThread; String tabTitle = null; String subject = adapter.getItem(position).sourceModel.subject; if (subject != null && subject.length() != 0) { tabTitle = subject; } else { Spanned spannedComment = adapter.getItem(position).spannedComment; if (spannedComment != null) { tabTitle = spannedComment.toString().replace('\n', ' '); if (tabTitle.length() > MAX_TITLE_LENGHT) tabTitle = tabTitle.substring(0, MAX_TITLE_LENGHT); } } if (tabTitle != null) tabTitle = resources.getString(R.string.tabs_title_threadpage_loaded, modelNewTab.boardName, tabTitle); UrlHandler.open(modelNewTab, activity, false, tabTitle); return true; case R.id.context_menu_thread_preview: showThreadPreviewDialog(position); return true; case R.id.context_menu_reply_no_reading: UrlPageModel model = new UrlPageModel(); model.chanName = chan.getChanName(); model.type = UrlPageModel.TYPE_THREADPAGE; model.boardName = tabModel.pageModel.boardName; model.threadNumber = adapter.getItem(position).sourceModel.parentThread; openPostForm(ChanModels.hashUrlPageModel(model), presentationModel.source.boardModel, getSendPostModel(model)); return true; case R.id.context_menu_hide: adapter.getItem(position).hidden = true; database.addHidden(tabModel.pageModel.chanName, tabModel.pageModel.boardName, pageType == TYPE_POSTSLIST ? tabModel.pageModel.threadNumber : adapter.getItem(position).sourceModel.number, pageType == TYPE_POSTSLIST ? adapter.getItem(position).sourceModel.number : null); adapter.notifyDataSetChanged(); return true; case R.id.context_menu_reply: openReply(position, false, null); return true; case R.id.context_menu_reply_with_quote: openReply(position, true, null); return true; case R.id.context_menu_select_text: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && lastContextMenuPosition == -1) { int firstPosition = listView.getFirstVisiblePosition() - listView.getHeaderViewsCount(); int wantedChild = position - firstPosition; if (wantedChild >= 0 && wantedChild < listView.getChildCount()) { View v = listView.getChildAt(wantedChild); if (v != null && v.getTag() != null && v.getTag() instanceof PostsListAdapter.PostViewTag) { ((PostsListAdapter.PostViewTag) v.getTag()).commentView.startSelection(); return true; } } } Clipboard.copyText(activity, adapter.getItem(position).spannedComment.toString()); Toast.makeText(activity, resources.getString(R.string.notification_comment_copied), Toast.LENGTH_LONG) .show(); return true; case R.id.context_menu_share: UrlPageModel sharePostUrlPageModel = new UrlPageModel(); sharePostUrlPageModel.chanName = chan.getChanName(); sharePostUrlPageModel.type = UrlPageModel.TYPE_THREADPAGE; sharePostUrlPageModel.boardName = tabModel.pageModel.boardName; sharePostUrlPageModel.threadNumber = tabModel.pageModel.threadNumber; sharePostUrlPageModel.postNumber = adapter.getItem(position).sourceModel.number; Intent sharePostIntent = new Intent(Intent.ACTION_SEND); sharePostIntent.setType("text/plain"); sharePostIntent.putExtra(Intent.EXTRA_SUBJECT, chan.buildUrl(sharePostUrlPageModel)); sharePostIntent.putExtra(Intent.EXTRA_TEXT, adapter.getItem(position).spannedComment.toString()); startActivity(Intent.createChooser(sharePostIntent, resources.getString(R.string.share_via))); return true; case R.id.context_menu_delete: DeletePostModel delModel = new DeletePostModel(); delModel.chanName = chan.getChanName(); delModel.boardName = tabModel.pageModel.boardName; delModel.threadNumber = tabModel.pageModel.threadNumber; delModel.postNumber = adapter.getItem(position).sourceModel.number; runDelete(delModel, adapter.getItem(position).sourceModel.attachments != null && adapter.getItem(position).sourceModel.attachments.length > 0); return true; case R.id.context_menu_report: DeletePostModel reportModel = new DeletePostModel(); reportModel.chanName = chan.getChanName(); reportModel.boardName = tabModel.pageModel.boardName; reportModel.threadNumber = tabModel.pageModel.threadNumber; reportModel.postNumber = adapter.getItem(position).sourceModel.number; runReport(reportModel); return true; case R.id.context_menu_subscribe: String chanName = chan.getChanName(); String board = tabModel.pageModel.boardName; String thread = tabModel.pageModel.threadNumber; String post = adapter.getItem(position).sourceModel.number; if (subscriptions.hasSubscription(chanName, board, thread, post)) { subscriptions.removeSubscription(chanName, board, thread, post); for (int i = position; i < adapter.getCount(); ++i) adapter.getItem(i).onUnsubscribe(post); } else { subscriptions.addSubscription(chanName, board, thread, post); for (int i = position; i < adapter.getCount(); ++i) adapter.getItem(i).onSubscribe(post); } adapter.notifyDataSetChanged(); return true; } return false; }
From source file:com.intel.xdk.device.Device.java
public void sendEmail(String body, String to, String subject, boolean ishtml, String cc, String bcc) { String toArray[] = to.split(","); String ccArray[] = cc.split(","); String bccArray[] = bcc.split(","); Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); // it's not ACTION_SEND if (ishtml) { //Android default mail clients poorly support html formatted mail :( //intent.setType("text/html"); //intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(body,null,null)); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, body); } else {//from ww w .ja v a 2 s. co m intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, body); } intent.putExtra(Intent.EXTRA_SUBJECT, subject); if (toArray.length > 0 && !toArray[0].equals("")) { intent.putExtra(Intent.EXTRA_EMAIL, toArray); } if (ccArray.length > 0 && !ccArray[0].equals("")) { intent.putExtra(Intent.EXTRA_CC, ccArray); } if (bccArray.length > 0 && !bccArray[0].equals("")) { intent.putExtra(Intent.EXTRA_BCC, bccArray); } intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //return user to app after sending mail activity.startActivity(intent); }
From source file:com.javielinux.utils.Utils.java
public static void sendLastCrash(Activity cnt) { try {// w w w. j a va 2 s . com Intent gmail = new Intent(Intent.ACTION_VIEW); gmail.setClassName("com.google.android.gm", "com.google.android.gm.ComposeActivityGmail"); gmail.putExtra(Intent.EXTRA_EMAIL, new String[] { cnt.getString(R.string.email_send_errors) }); gmail.setData(Uri.parse(cnt.getString(R.string.email_send_errors))); gmail.putExtra(Intent.EXTRA_SUBJECT, "TweetTopics crash"); gmail.setType("plain/text"); gmail.putExtra(Intent.EXTRA_TEXT, ErrorReporter.getErrors(cnt)); cnt.startActivity(gmail); } catch (ActivityNotFoundException e) { Intent msg = new Intent(Intent.ACTION_SEND); msg.putExtra(Intent.EXTRA_EMAIL, new String[] { cnt.getString(R.string.email_send_errors) }); msg.putExtra(Intent.EXTRA_SUBJECT, "TweetTopics crash"); msg.setType("plain/text"); msg.putExtra(Intent.EXTRA_TEXT, ErrorReporter.getErrors(cnt)); cnt.startActivity(msg); } }
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);// w w w . j a v a 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,/*from ww w . j a v a 2s . co m*/ 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.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 ww w .j av a 2s .c o m*/ }
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.ludoscity.findmybikes.activities.NearbyActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.settings_menu_item: Intent settingsIntent = new Intent(this, SettingsActivity.class); startActivityForResult(settingsIntent, SETTINGS_ACTIVITY_REQUEST_CODE); return true; case R.id.about_menu_item: new MaterialDialog.Builder(this) .title(getString(R.string.app_name) + " " + getString(R.string.app_version_name) + " 20152017 F8Full") //http://stackoverflow.com/questions/4471025/how-can-you-get-the-manifest-version-number-from-the-apps-layout-xml-variable--> .items(R.array.about_dialog_items) .icon(ContextCompat.getDrawable(NearbyActivity.this, R.drawable.logo_48dp)).autoDismiss(false) .itemsCallback(new MaterialDialog.ListCallback() { @Override/*from ww w . j ava 2 s . co m*/ public void onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { Intent intent; switch (which) { case 0: startActivity(Utils.getWebIntent(NearbyActivity.this, "http://www.citybik.es", true, text.toString())); break; case 1: intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://details?id=com.ludoscity.findmybikes")); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } break; case 2: String url = "https://www.facebook.com/findmybikes/"; Uri uri; try { getPackageManager().getPackageInfo("com.facebook.katana", 0); // http://stackoverflow.com/questions/24526882/open-facebook-page-from-android-app-in-facebook-version-v11 uri = Uri.parse("fb://facewebmodal/f?href=" + url); intent = new Intent(Intent.ACTION_VIEW, uri); } catch (PackageManager.NameNotFoundException e) { intent = Utils.getWebIntent(NearbyActivity.this, url, true, text.toString()); } //Seen ActivityNotFoundException in firebase cloud lab (FB package found but can't be launched) if (intent.resolveActivity(getPackageManager()) == null) intent = Utils.getWebIntent(NearbyActivity.this, url, true, text.toString()); startActivity(intent); break; case 3: intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:")); // only email apps should handle this intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "ludos+findmybikesfeedback" + getString(R.string.app_version_name) + "@ludoscity.com" }); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.feedback_subject)); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } break; case 4: new LicensesDialog.Builder(NearbyActivity.this).setNotices(R.raw.notices).build() .show(); break; case 5: intent = new Intent(NearbyActivity.this, WebViewActivity.class); intent.putExtra(WebViewActivity.EXTRA_URL, "file:///android_res/raw/privacy_policy.html"); intent.putExtra(WebViewActivity.EXTRA_ACTIONBAR_SUBTITLE, getString(R.string.hashtag_privacy)); startActivity(intent); break; case 6: try { // get the Twitter app if possible getPackageManager().getPackageInfo("com.twitter.android", 0); intent = new Intent(Intent.ACTION_VIEW, Uri.parse("twitter://user?screen_name=findmybikesdata")); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } catch (PackageManager.NameNotFoundException e) { // no Twitter app, revert to browser intent = Utils.getWebIntent(NearbyActivity.this, "https://twitter.com/findmybikesdata", true, text.toString()); } if (intent.resolveActivity(getPackageManager()) == null) intent = Utils.getWebIntent(NearbyActivity.this, "https://twitter.com/findmybikesdata", true, text.toString()); startActivity(intent); break; case 7: intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/f8full/ludOScity/tree/master/FindMyBikes")); startActivity(intent); break; } } }).show(); return true; } return super.onOptionsItemSelected(item); }