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:com.googlecode.android_scripting.facade.AndroidFacade.java
@Rpc(description = "Launches an activity that sends an e-mail message to a given recipient.") public void sendEmail( @RpcParameter(name = "to", description = "A comma separated list of recipients.") final String to, @RpcParameter(name = "subject") final String subject, @RpcParameter(name = "body") final String body, @RpcParameter(name = "attachmentUri") @RpcOptional final String attachmentUri) { final Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("plain/text"); intent.putExtra(android.content.Intent.EXTRA_EMAIL, to.split(",")); intent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); intent.putExtra(android.content.Intent.EXTRA_TEXT, body); if (attachmentUri != null) { intent.putExtra(android.content.Intent.EXTRA_STREAM, Uri.parse(attachmentUri)); }// w ww. j av a 2s . c o m startActivity(intent); }
From source file:com.flipzu.flipzu.Player.java
private void share() { if (mUser == null || bcast == null) return;/*from www . j a v a2 s. c o m*/ //create the intent Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); //set the type shareIntent.setType("text/plain"); //add a subject shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mUser.getFullname() + " live on FlipZu"); String text = bcast.getText(); if (text == null) { text = mUser.getUsername() + " live on FlipZu"; } //build the body of the message to be shared String shareMessage = text + " - http://fzu.fm/" + bcast.getId(); //add the message shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareMessage); //start the chooser for sharing startActivity(Intent.createChooser(shareIntent, getText(R.string.share_bcast_with))); }
From source file:com.googlecode.CallerLookup.Main.java
public void doSubmit() { String entry = ""; if (mLookup.getSelectedItemPosition() != 0) { entry = mLookup.getSelectedItem().toString() + "\n"; }// w w w .j av a2 s . c o m entry += mURL.getText().toString() + "\n"; entry += mRegExp.getText().toString() + "\n"; try { String[] mailto = { EMAIL_ADDRESS }; Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto); sendIntent.putExtra(Intent.EXTRA_SUBJECT, EMAIL_SUBJECT); sendIntent.putExtra(Intent.EXTRA_TEXT, entry); sendIntent.setType("message/rfc822"); startActivity(sendIntent); } catch (ActivityNotFoundException e) { e.printStackTrace(); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.SubmitFailureTitle); alert.setMessage(R.string.SubmitFailureMessage); alert.setPositiveButton(android.R.string.ok, null); alert.show(); } }
From source file:com.ubuntuone.android.files.service.UpDownService.java
private void setAutoUploadInfo(String info) { Intent broadcast = new Intent(BROADCAST_UPLOAD_INFO); broadcast.putExtra(Intent.EXTRA_TEXT, info); sendBroadcast(broadcast); }
From source file:com.audiokernel.euphonyrmt.fragments.NowPlayingFragment.java
@Override public boolean onMenuItemClick(final MenuItem item) { final AlbumInfo albumInfo; boolean result = true; final int itemId = item.getItemId(); switch (item.getItemId()) { case POPUP_COVER_BLACKLIST: albumInfo = new AlbumInfo(mCurrentSong); CoverManager.getInstance().markWrongCover(albumInfo); downloadCover(albumInfo);/*from w w w.j a v a2s . c om*/ updateQueueCovers(albumInfo); break; case POPUP_COVER_SELECTIVE_CLEAN: albumInfo = new AlbumInfo(mCurrentSong); CoverManager.getInstance().clear(albumInfo); downloadCover(albumInfo); updateQueueCovers(albumInfo); break; case POPUP_CURRENT: scrollToNowPlaying(); break; case POPUP_SHARE: final Intent intent = new Intent(Intent.ACTION_SEND, null); intent.putExtra(Intent.EXTRA_TEXT, getShareString()); intent.setType("text/plain"); startActivity(intent); break; default: result = isSimpleLibraryItem(itemId); break; } return result; }
From source file:com.ryan.ryanreader.fragments.CommentListingFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); if (info.position <= 0) return false; final Action action = Action.values()[item.getItemId()]; final RedditPreparedComment comment = (RedditPreparedComment) lv.getAdapter().getItem(info.position); switch (action) { case UPVOTE:/*from ww w. j av a 2 s .c o m*/ comment.action(getSupportActivity(), RedditAPI.RedditAction.UPVOTE); break; case DOWNVOTE: comment.action(getSupportActivity(), RedditAPI.RedditAction.DOWNVOTE); break; case UNVOTE: comment.action(getSupportActivity(), RedditAPI.RedditAction.UNVOTE); break; case REPORT: new AlertDialog.Builder(getSupportActivity()).setTitle(R.string.action_report) .setMessage(R.string.action_report_sure) .setPositiveButton(R.string.action_report, new DialogInterface.OnClickListener() { public void onClick(final DialogInterface dialog, final int which) { comment.action(getSupportActivity(), RedditAPI.RedditAction.REPORT); // TODO update the view to show the result } }).setNegativeButton(R.string.dialog_cancel, null).show(); break; case REPLY: { final Intent intent = new Intent(getSupportActivity(), CommentReplyActivity.class); intent.putExtra("parentIdAndType", comment.idAndType); startActivity(intent); break; } case EDIT: { final Intent intent = new Intent(getSupportActivity(), CommentEditActivity.class); intent.putExtra("commentIdAndType", comment.idAndType); intent.putExtra("commentText", comment.src.body); startActivity(intent); break; } case COMMENT_LINKS: final HashSet<String> linksInComment = comment.computeAllLinks(); if (linksInComment.isEmpty()) { General.quickToast(getSupportActivity(), R.string.error_toast_no_urls_in_comment); } else { final String[] linksArr = linksInComment.toArray(new String[linksInComment.size()]); final AlertDialog.Builder builder = new AlertDialog.Builder(getSupportActivity()); builder.setItems(linksArr, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { LinkHandler.onLinkClicked(getSupportActivity(), linksArr[which], false); dialog.dismiss(); } }); final AlertDialog alert = builder.create(); alert.setTitle(R.string.action_comment_links); alert.setCanceledOnTouchOutside(true); alert.show(); } break; case SHARE: final Intent mailer = new Intent(Intent.ACTION_SEND); mailer.setType("text/plain"); mailer.putExtra(Intent.EXTRA_SUBJECT, "Comment by " + comment.src.author + " on Reddit"); // TODO this currently just dumps the markdown mailer.putExtra(Intent.EXTRA_TEXT, StringEscapeUtils.unescapeHtml4(comment.src.body)); startActivityForResult(Intent.createChooser(mailer, context.getString(R.string.action_share)), 1); break; case COPY: ClipboardManager manager = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE); // TODO this currently just dumps the markdown manager.setText(StringEscapeUtils.unescapeHtml4(comment.src.body)); break; case COLLAPSE: if (comment.getBoundView() != null) handleCommentVisibilityToggle(comment.getBoundView()); break; case USER_PROFILE: UserProfileDialog.newInstance(comment.src.author).show(getSupportActivity()); break; case PROPERTIES: CommentPropertiesDialog.newInstance(comment.src).show(getSupportActivity()); break; } return true; }
From source file:at.alladin.rmbt.android.adapter.result.RMBTResultPagerAdapter.java
/** * /* w w w . j av a 2 s .co m*/ */ public void startShareResultsIntent() { try { JSONObject resultListItem = testResult.getJSONObject(0); final String shareText = resultListItem.getString("share_text"); final String shareSubject = resultListItem.getString("share_subject"); final Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, shareText); sendIntent.putExtra(Intent.EXTRA_SUBJECT, shareSubject); sendIntent.setType("text/plain"); activity.startActivity(Intent.createChooser(sendIntent, null)); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.transistorsoft.cordova.bggeo.CDVBackgroundGeolocation.java
private void emailLog(final CallbackContext callback, final String email) { cordova.getThreadPool().execute(new Runnable() { public void run() { String log = readLog(); if (log == null) { callback.error(500);/*from ww w. ja va 2 s .c om*/ return; } Intent mailer = new Intent(Intent.ACTION_SEND); mailer.setType("message/rfc822"); mailer.putExtra(Intent.EXTRA_EMAIL, new String[] { email }); mailer.putExtra(Intent.EXTRA_SUBJECT, "BackgroundGeolocation log"); try { JSONObject state = getState(); if (state.has("license")) { state.put("license", "<SECRET>"); } if (state.has("orderId")) { state.put("orderId", "<SECRET>"); } mailer.putExtra(Intent.EXTRA_TEXT, state.toString(4)); } catch (JSONException e) { Log.w(TAG, "- Failed to write state to email body"); e.printStackTrace(); } File file = new File(Environment.getExternalStorageDirectory(), "background-geolocation.log"); try { FileOutputStream stream = new FileOutputStream(file); try { stream.write(log.getBytes()); stream.close(); mailer.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); file.deleteOnExit(); } catch (IOException e) { e.printStackTrace(); } } catch (FileNotFoundException e) { Log.i(TAG, "FileNotFound"); e.printStackTrace(); } try { cordova.getActivity() .startActivityForResult(Intent.createChooser(mailer, "Send log: " + email + "..."), 1); callback.success(); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(cordova.getActivity(), "There are no email clients installed.", Toast.LENGTH_SHORT).show(); callback.error("There are no email clients installed"); } } }); }
From source file:com.maskyn.fileeditorpro.activity.MainActivity.java
/** * Parses the intent//from w ww . j a va 2 s .com */ private void parseIntent(Intent intent) { final String action = intent.getAction(); final String type = intent.getType(); if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_EDIT.equals(action) || Intent.ACTION_PICK.equals(action) && type != null) { // Post event //newFileToOpen(new File(intent // .getData().getPath()), ""); Uri uri = intent.getData(); GreatUri newUri = new GreatUri(uri, AccessStorageApi.getPath(this, uri), AccessStorageApi.getName(this, uri)); newFileToOpen(newUri, ""); } else if (Intent.ACTION_SEND.equals(action) && type != null) { if ("text/plain".equals(type)) { newFileToOpen(new GreatUri(Uri.EMPTY, "", ""), intent.getStringExtra(Intent.EXTRA_TEXT)); } } }
From source file:com.justone.android.main.MainActivity.java
public void shareOnClick(View view) { String shareTitle = ""; String shareContent = " "; if (tabs.getCurrentTabTag() == "home tab") { shareTitle = "home tab"; shareContent = shareContent + ((TextView) this.findViewById(R.id.fPage_tView)).getText().toString() + ((TextView) this.findViewById(R.id.imageBelow_tView)).getText().toString() + "() " + ((TextView) this.findViewById(R.id.home_share_url)).getText().toString(); } else if (tabs.getCurrentTabTag() == "QA Tab") { shareTitle = "QA Tab"; shareContent = shareContent + ((TextView) this.findViewById(R.id.question_content)).getText().toString() + " - () " + ((TextView) this.findViewById(R.id.qa_share_url)).getText().toString(); } else if (tabs.getCurrentTabTag() == "list tab") { shareTitle = "list tab"; shareContent = shareContent + "" + ((TextView) this.findViewById(R.id.one_content_title)).getText().toString() + " by " + ((TextView) this.findViewById(R.id.one_content_author)).getText().toString() + "- () " + ((TextView) this.findViewById(R.id.list_share_url)).getText().toString(); }//from w w w . ja v a2s . co m Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); // intent.setPackage("com.sina.weibo"); intent.putExtra(Intent.EXTRA_SUBJECT, ""); //intent.putExtra(Intent.EXTRA_TEXT, shareTitle+" VOL.516 () http://caodan.org/516-photo.html "); intent.putExtra(Intent.EXTRA_TEXT, shareContent); intent.putExtra(Intent.EXTRA_TITLE, shareTitle); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(Intent.createChooser(intent, "")); }