List of usage examples for android.content Intent EXTRA_EMAIL
String EXTRA_EMAIL
To view the source code for android.content Intent EXTRA_EMAIL.
Click Source Link
From source file:com.physphil.android.restaurantroulette.MainActivity.java
/** * Send email to developer// ww w. jav a2 s .c om */ private void emailDeveloper() { Intent i = new Intent(Intent.ACTION_SEND); i.setType("message/rfc822"); i.putExtra(Intent.EXTRA_EMAIL, new String[] { Constants.DEVELOPER_EMAIL_ADDRESS }); i.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.email_subject)); i.putExtra(Intent.EXTRA_TEXT, getString(R.string.email_body)); startActivity(i); }
From source file:nextinnnovationsoft.com.weightlossrecepies.activity.MainActivity.java
private void openSubmitBug() { String to = "sarkerpt@gmail.com"; String subject = "Weight Loss Recipes Light For Android - Bug Report"; Intent email = new Intent(Intent.ACTION_SEND); email.putExtra(Intent.EXTRA_EMAIL, new String[] { to }); email.putExtra(Intent.EXTRA_SUBJECT, subject); email.setType("message/rfc822"); startActivity(Intent.createChooser(email, "Choose an Email client :")); }
From source file:com.liquid.wallpapers.free.ScroidWallpaperGallery.java
private void handleOnCommunicationChosen(Communication communication) { Wallpaper wallpaper = this.selectedWallpaper; if (communication.getType().equals(Communication.Type.Email)) { Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { communication.getValue() }); intent.putExtra(Intent.EXTRA_SUBJECT, getBaseContext().getString(R.string.applicationName)); intent.putExtra(Intent.EXTRA_TEXT, String.format( getBaseContext().getString(R.string.recommendEmailPattern), wallpaper.getWallpaperUrl())); intent.setType(Messages.getString("ScroidWallpaperGallery.0")); //$NON-NLS-1$ this.startActivity(intent); } else if (communication.getType().equals(Communication.Type.Mobile)) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.putExtra(Messages.getString("ScroidWallpaperGallery.1"), communication.getValue()); //$NON-NLS-1$ intent.putExtra(Messages.getString("ScroidWallpaperGallery.2"), //$NON-NLS-1$ String.format(getBaseContext().getString(R.string.recommendSmsPattern), wallpaper.getWallpaperUrl())); intent.setType(Messages.getString("ScroidWallpaperGallery.3")); //$NON-NLS-1$ this.startActivity(intent); }/* w w w.j a v a2 s. com*/ }
From source file:com.artemchep.horario.ui.fragments.details.TeacherDetailsFragment.java
@Override protected ViewGroup onCreateContentView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @NonNull List<ContentItem<Teacher>> contentItems, @Nullable Bundle savedInstanceState) { getToolbar().inflateMenu(R.menu.details_teacher); ViewGroup vg = (ViewGroup) inflater.inflate(R.layout.fragment_details_teacher, container, false); initWithFab(R.id.action_edit, R.drawable.ic_pencil_white_24dp); mNoteContainer = vg.findViewById(R.id.info_container); mPhoneContainer = vg.findViewById(R.id.phone_container); mPhoneContainer.setOnClickListener(new View.OnClickListener() { @Override//from w w w. j a va 2s .co m public void onClick(View view) { if (TextUtils.isEmpty(mModel.phone)) { Timber.tag(TAG).w("Tried to copy an empty phone!"); return; } // Copy email to clipboard ClipboardManager clipboard = (ClipboardManager) getContext() .getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText(mModel.phone, mModel.phone); // TODO: More informative description of the clip clipboard.setPrimaryClip(clip); // Show toast message String msg = getString(R.string.details_phone_clipboard, mModel.phone); Toasty.info(getContext(), msg).show(); } }); mEmailContainer = vg.findViewById(R.id.email_container); mEmailContainer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (TextUtils.isEmpty(mModel.email)) { Timber.tag(TAG).w("Tried to copy an empty email!"); return; } // Copy email to clipboard ClipboardManager clipboard = (ClipboardManager) getContext() .getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText(mModel.email, mModel.email); // TODO: More informative description of the clip clipboard.setPrimaryClip(clip); // Show toast message String msg = getString(R.string.details_email_clipboard, mModel.email); Toasty.info(getContext(), msg).show(); } }); mPhoneButton = (Button) mPhoneContainer.findViewById(R.id.phone_send); mPhoneButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (TextUtils.isEmpty(mModel.phone)) { Timber.tag(TAG).w("Tried to call an empty phone!"); return; } Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + mModel.phone)); try { startActivity(intent); } catch (ActivityNotFoundException ignored) { } } }); mEmailButton = (Button) mEmailContainer.findViewById(R.id.email_send); mEmailButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (TextUtils.isEmpty(mModel.email)) { Timber.tag(TAG).w("Tried to send to an empty email!"); return; } String[] recipients = { mModel.email }; Intent intent = new Intent().putExtra(Intent.EXTRA_EMAIL, recipients); intent.setAction(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:")); // only email apps should handle it try { startActivity(intent); } catch (ActivityNotFoundException e) { // TODO:!!!!! String msg = "No email app"; //getString(R.string.feedback_error_no_app); Toasty.info(getContext(), msg).show(); } } }); mNoteTextView = (TextView) mNoteContainer.findViewById(R.id.info); mEmailTextView = (TextView) mEmailContainer.findViewById(R.id.email); mPhoneTextView = (TextView) mPhoneContainer.findViewById(R.id.phone); // Note contentItems.add(new ContentItem<Teacher>() { @Override public void onSet(@Nullable Teacher model) { if (model == null || TextUtils.isEmpty(model.info)) { mNoteContainer.setVisibility(View.GONE); } else { mNoteContainer.setVisibility(View.VISIBLE); mNoteTextView.setText(model.info); } } @Override public boolean hasChanged(@Nullable Teacher old, @Nullable Teacher model) { String a = old != null ? old.info : null; String b = model != null ? model.info : null; return !TextUtils.equals(a, b); } }); // Email contentItems.add(new ContentItem<Teacher>() { @Override public void onSet(@Nullable Teacher model) { if (model == null || TextUtils.isEmpty(model.email)) { mEmailContainer.setVisibility(View.GONE); } else { mEmailContainer.setVisibility(View.VISIBLE); mEmailTextView.setText(model.info); if (PatternUtils.isEmail(model.email)) { mEmailButton.setVisibility(View.VISIBLE); } else mEmailButton.setVisibility(View.GONE); } } @Override public boolean hasChanged(@Nullable Teacher old, @Nullable Teacher model) { String a = old != null ? old.email : null; String b = model != null ? model.email : null; return !TextUtils.equals(a, b); } }); // Phone contentItems.add(new ContentItem<Teacher>() { @Override public void onSet(@Nullable Teacher model) { if (model == null || TextUtils.isEmpty(model.phone)) { mPhoneContainer.setVisibility(View.GONE); } else { mPhoneContainer.setVisibility(View.VISIBLE); mPhoneTextView.setText(model.phone); if (PatternUtils.isPhone(model.phone)) { mPhoneButton.setVisibility(View.VISIBLE); } else mPhoneButton.setVisibility(View.GONE); } } @Override public boolean hasChanged(@Nullable Teacher old, @Nullable Teacher model) { String a = old != null ? old.phone : null; String b = model != null ? model.phone : null; return !TextUtils.equals(a, b); } }); return vg; }
From source file:de.guj.ems.mobile.sdk.test.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle app icon touch if (mDrawerToggle != null && mDrawerToggle.onOptionsItemSelected(item)) { return true; }// w ww . ja va 2s . co m // Handle action buttons int menuId = item.getItemId(); if (menuId == R.id.reload) { SdkUtil.reloadAds(this); return true; } else if (menuId == R.id.web) { Intent i = new Intent(MainActivity.this, Browser.class); i.putExtra(Browser.URL_EXTRA, "http://m.ems.guj.de/"); i.putExtra(Browser.SHOW_BACK_EXTRA, true); i.putExtra(Browser.SHOW_FORWARD_EXTRA, true); i.putExtra(Browser.SHOW_REFRESH_EXTRA, true); startActivity(i); return true; } else if (menuId == R.id.showroom) { Intent i = new Intent(MainActivity.this, Browser.class); i.putExtra(Browser.URL_EXTRA, "http://showcase.emsmobile.de/"); i.putExtra(Browser.SHOW_BACK_EXTRA, true); i.putExtra(Browser.SHOW_FORWARD_EXTRA, true); i.putExtra(Browser.SHOW_REFRESH_EXTRA, true); startActivity(i); return true; } else if (menuId == R.id.mail) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/html"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "adtechnology@ems.guj.de" }); intent.putExtra(Intent.EXTRA_SUBJECT, "G+J EMS Sample App (Android)"); intent.putExtra(Intent.EXTRA_TEXT, ""); startActivity(Intent.createChooser(intent, "Kontakt")); return true; } return super.onOptionsItemSelected(item); }
From source file:ayushi.view.fragment.SettingsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.frag_settings, container, false); getActivity().setTitle("About App"); mToolbar = (Toolbar) rootView.findViewById(R.id.htab_toolbar); if (mToolbar != null) { ((ECartHomeActivity) getActivity()).setSupportActionBar(mToolbar); }/*from w ww. j a v a2s. c o m*/ if (mToolbar != null) { ((ECartHomeActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); mToolbar.setNavigationIcon(R.drawable.ic_drawer); } mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((ECartHomeActivity) getActivity()).getmDrawerLayout().openDrawer(GravityCompat.START); } }); mToolbar.setTitleTextColor(Color.WHITE); submitLog = (TextView) rootView.findViewById(R.id.submit_log_txt); if (PreferenceHelper.getPrefernceHelperInstace().getBoolean(getActivity(), PreferenceHelper.SUBMIT_LOGS, true)) { submitLog.setText("Disable"); } else { submitLog.setText("Enable"); } rootView.findViewById(R.id.submit_log).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (PreferenceHelper.getPrefernceHelperInstace().getBoolean(getActivity(), PreferenceHelper.SUBMIT_LOGS, true)) { PreferenceHelper.getPrefernceHelperInstace().setBoolean(getActivity(), PreferenceHelper.SUBMIT_LOGS, false); submitLog.setText("Disable"); } else { PreferenceHelper.getPrefernceHelperInstace().setBoolean(getActivity(), PreferenceHelper.SUBMIT_LOGS, true); submitLog.setText("Enable"); } } }); rootView.setFocusableInTouchMode(true); rootView.requestFocus(); rootView.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { Utils.switchContent(R.id.frag_container, Utils.HOME_FRAGMENT, ((ECartHomeActivity) (getContext())), AnimationType.SLIDE_UP); } return true; } }); rootView.findViewById(R.id.picasso).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/square/picasso")); startActivity(browserIntent); } }); rootView.findViewById(R.id.acra).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/ACRA/acra")); startActivity(browserIntent); } }); rootView.findViewById(R.id.pull_zoom_view).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/Frank-Zhu/PullZoomView")); startActivity(browserIntent); } }); rootView.findViewById(R.id.list_buddies).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/jpardogo/ListBuddies")); startActivity(browserIntent); } }); rootView.findViewById(R.id.list_jazzy).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/twotoasters/JazzyListView")); startActivity(browserIntent); } }); rootView.findViewById(R.id.email_dev).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("text/plain"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "serveroverloadofficial@gmail.com" }); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Hello There"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Add Message here"); emailIntent.setType("message/rfc822"); try { startActivity(Intent.createChooser(emailIntent, "Send email using...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(getActivity(), "No email clients installed.", Toast.LENGTH_SHORT).show(); } } }); return rootView; }
From source file:org.isoron.uhabits.activities.BaseScreen.java
public void showSendEmailScreen(@StringRes int toId, @StringRes int subjectId, String content) { String to = activity.getString(toId); String subject = activity.getString(subjectId); Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { to }); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, content); activity.startActivity(intent);/*from w w w . j ava 2 s .co m*/ }
From source file:foam.jellyfish.StarwispBuilder.java
public static void email(Context context, String emailTo, String emailCC, String subject, String emailText, List<String> filePaths) { //need to "send multiple" to get more than one attachment final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE); emailIntent.setType("text/plain"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { emailTo }); emailIntent.putExtra(android.content.Intent.EXTRA_CC, new String[] { emailCC }); emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); ArrayList<String> extra_text = new ArrayList<String>(); extra_text.add(emailText);//w w w .ja va 2s . co m emailIntent.putStringArrayListExtra(Intent.EXTRA_TEXT, extra_text); //emailIntent.putExtra(Intent.EXTRA_TEXT, emailText); //has to be an ArrayList ArrayList<Uri> uris = new ArrayList<Uri>(); //convert from paths to Android friendly Parcelable Uri's for (String file : filePaths) { File fileIn = new File(file); Uri u = Uri.fromFile(fileIn); uris.add(u); } emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); context.startActivity(Intent.createChooser(emailIntent, "Send mail...")); }
From source file:com.dm.material.dashboard.candybar.adapters.IntentAdapter.java
private Intent addIntentExtra(@NonNull Intent intent) { intent.setType("message/rfc822"); if (mRequest.getStream().length() > 0) { File zip = new File(mRequest.getStream()); Uri uri = FileHelper.getUriFromFile(mContext, mContext.getPackageName(), zip); if (uri == null) uri = Uri.fromFile(zip);// w ww. j a v a2s .co m intent.putExtra(Intent.EXTRA_STREAM, uri); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); } intent.putExtra(Intent.EXTRA_EMAIL, new String[] { mContext.getResources().getString(R.string.dev_email) }); intent.putExtra(Intent.EXTRA_SUBJECT, mRequest.getSubject()); intent.putExtra(Intent.EXTRA_TEXT, mRequest.getText()); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); return intent; }
From source file:com.secupwn.aimsicd.ui.activities.DebugLogs.java
public void sendEmail() { new Thread() { @Override/*w w w . j a v a 2 s . c om*/ public void run() { // Send Error Log try { String helpUs = getString(R.string.describe_the_problem_you_had); String log = helpUs + "\n\n" + "GETPROP:" + "\n\n" + getProp() + "\n\n" + "LOGCAT:" + "\n\n" + getLogs() + "\n\n" + helpUs; // show a share intent Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/html"); // E-Mail address will ONLY be handed out when a DEVELOPER asked for the logs! intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "See GitHub Issues first!" }); intent.putExtra(Intent.EXTRA_SUBJECT, "AIMSICD Error Log"); intent.putExtra(Intent.EXTRA_TEXT, log); startActivity(Intent.createChooser(intent, "Send Error Log")); } catch (IOException e) { log.warn("Error reading logs", e); } } }.start(); }