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:spit.matrix2017.Fragments.ContactUsFragment.java
@Nullable @Override/*from w ww . java 2 s . com*/ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_contactus, container, false); findOnMap = (Button) view.findViewById(R.id.findOnMap); visitWebsite = (Button) view.findViewById(R.id.visitWebsite); contact_one_Button = (AppCompatImageButton) view.findViewById(R.id.contact_us_call_one); contact_two_Button = (AppCompatImageButton) view.findViewById(R.id.contact_us_call_two); save_one_Button = (AppCompatImageButton) view.findViewById(R.id.contact_us_save_one); save_two_Button = (AppCompatImageButton) view.findViewById(R.id.contact_us_save_two); emailId_matrix_TextView = (TextView) view.findViewById(R.id.emailId_matrix_TextView); emailId_matrix_TextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String to = "principal@spit.ac.in"; Intent intent = new Intent(); intent.setAction(Intent.ACTION_SENDTO); intent.setType("text/plain"); intent.setData(Uri.parse("mailto:" + to)); intent.putExtra(Intent.EXTRA_EMAIL, to); try { startActivity(Intent.createChooser(intent, "Send Email")); } catch (Exception e) { Toast.makeText(getActivity(), e.getStackTrace().toString(), Toast.LENGTH_SHORT).show(); } } }); visitWebsite.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.spit.ac.in"))); } }); findOnMap.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Uri uri = Uri .parse("http://maps.google.com/maps?q=" + Uri.encode(getString(R.string.college_name))); Intent mapIntent = new Intent(Intent.ACTION_VIEW, uri); mapIntent.setPackage("com.google.android.apps.maps"); try { startActivity(mapIntent); } catch (ActivityNotFoundException ex) { try { Intent newIntent = new Intent(Intent.ACTION_VIEW, uri); startActivity(newIntent); } catch (ActivityNotFoundException innerEx) { Toast.makeText(getContext(), "Please install a maps application", Toast.LENGTH_LONG).show(); } } } }); View.OnClickListener dialerOnClickListener = new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_DIAL); switch (v.getId()) { case R.id.contact_us_call_one: intent.setData(Uri.parse("tel:" + "02226707440")); break; case R.id.contact_us_call_two: intent.setData(Uri.parse("tel:" + "02226287250")); break; } startActivity(intent); } }; contact_one_Button.setOnClickListener(dialerOnClickListener); contact_two_Button.setOnClickListener(dialerOnClickListener); View.OnClickListener saveOnClickListener = new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_INSERT, ContactsContract.Contacts.CONTENT_URI); switch (v.getId()) { case R.id.contact_us_save_one: intent.putExtra(ContactsContract.Intents.Insert.NAME, "S.P.I.T."); intent.putExtra(ContactsContract.Intents.Insert.PHONE, "02226707440"); break; case R.id.contact_us_save_two: intent.putExtra(ContactsContract.Intents.Insert.NAME, "S.P.I.T."); intent.putExtra(ContactsContract.Intents.Insert.PHONE, "02226708520"); break; } startActivity(intent); } }; save_one_Button.setOnClickListener(saveOnClickListener); save_two_Button.setOnClickListener(saveOnClickListener); return view; }
From source file:info.schnatterer.logbackandroiddemo.SendLogActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /* Get URIs for log files using android.support.v4.content.FileProvider */ ArrayList<Uri> uris = new ArrayList<>(); for (final File fileEntry : Logs.getLogFiles(this)) { // Don't recurse! if (!fileEntry.isDirectory()) { // Create content provider URI uris.add(FileProvider.getUriForFile(this, getString(R.string.authority_log_file_provider), fileEntry));/*from w w w .j av a 2s . c o m*/ } } final Intent email = new Intent(Intent.ACTION_SEND_MULTIPLE); email.setType("message/rfc822"); email.putExtra(Intent.EXTRA_EMAIL, new String[] { "a@b.c" }); email.putExtra(Intent.EXTRA_SUBJECT, getString(getApplicationInfo().labelRes)); email.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); email.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); startActivity(email); finish(); }
From source file:com.lauszus.dronedraw.DroneDrawActivity.java
private void sendEmail(File file) { Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setType("vnd.android.cursor.dir/email"); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "lauszus@gmail.com" }); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Drone path"); emailIntent.putExtra(Intent.EXTRA_TEXT, "Please see attachment"); emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); if (emailIntent.resolveActivity(getPackageManager()) != null) { // Make sure that an app exist that can handle the intent startActivity(emailIntent);/*from ww w .ja v a 2 s . co m*/ } else Toast.makeText(getApplicationContext(), "No email app found", Toast.LENGTH_SHORT).show(); }
From source file:com.bordengrammar.bordengrammarapp.ParentsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_parents, container, false); mail = (LinearLayout) root.findViewById(R.id.linmail); call = (LinearLayout) root.findViewById(R.id.lincall); call.setOnClickListener(new View.OnClickListener() { @Override/* ww w.ja v a2s .c om*/ public void onClick(View arg0) { Intent cally = new Intent(Intent.ACTION_CALL); cally.setData(Uri.parse("tel:01795424192")); startActivity(cally); } }); mail.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { AlertDialog.Builder alert = new AlertDialog.Builder(getActivity()); alert.setTitle("Send a email to Borden Grammar"); alert.setMessage("Message: "); final EditText input = new EditText(getActivity()); alert.setView(input); alert.setPositiveButton("Send", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String value = input.getText().toString(); // Do something with value! Intent email = new Intent(Intent.ACTION_SEND); email.setType("plain/text"); email.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "school@bordengrammar.kent.sch.uk" }); email.putExtra(Intent.EXTRA_SUBJECT, "Email (Sent From BGS APP) "); email.putExtra(Intent.EXTRA_TEXT, value); startActivity(Intent.createChooser(email, "Choose an Email client :")); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Canceled. } }); alert.show(); } }); URL url = null; try { url = new URL( "http://website.bordengrammar.kent.sch.uk/index.php?option=com_rubberdoc&view=category&id=63%3Aletters&Itemid=241&format=feed&type=rss"); } catch (MalformedURLException e) { e.printStackTrace(); } Feed feed = null; try { feed = FeedParser.parse(url); } catch (FeedIOException e) { e.printStackTrace(); } catch (FeedXMLParseException e) { e.printStackTrace(); } catch (UnsupportedFeedException e) { e.printStackTrace(); } Boolean nully = false; for (int i = 0; i < 3; i++) { try { FeedItem item = feed.getItem(i); } catch (NullPointerException e) { e.printStackTrace(); nully = true; Toast.makeText(getActivity().getApplicationContext(), "Some features of this app require a internet connection", Toast.LENGTH_LONG).show(); } } if (!nully) { final FeedItem post1 = feed.getItem(1); final FeedItem post2 = feed.getItem(2); final FeedItem post3 = feed.getItem(3); TextView title1 = (TextView) root.findViewById(R.id.title1); TextView title2 = (TextView) root.findViewById(R.id.title2); TextView title3 = (TextView) root.findViewById(R.id.title3); title1.setText(post1.getTitle()); title2.setText(post2.getTitle()); title3.setText(post3.getTitle()); TextView link1 = (TextView) root.findViewById(R.id.link1); TextView link2 = (TextView) root.findViewById(R.id.link2); TextView link3 = (TextView) root.findViewById(R.id.link3); link1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String url1 = post1.getLink().toString(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(url1), "text/html"); startActivity(intent); } }); link2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String url1 = post2.getLink().toString(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(url1), "text/html"); startActivity(intent); } }); link3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String url1 = post3.getLink().toString(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(url1), "text/html"); startActivity(intent); } }); } else { TextView title1 = (TextView) root.findViewById(R.id.title1); TextView title2 = (TextView) root.findViewById(R.id.title2); TextView title3 = (TextView) root.findViewById(R.id.title3); title1.setText("No connection"); title2.setText("No connection"); title3.setText("No connection"); } TextView reader = (TextView) root.findViewById(R.id.reader); reader.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String appPackageName = "com.adobe.reader"; // getPackageName() from Context or Activity object try { startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); } catch (android.content.ActivityNotFoundException anfe) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName))); } } }); return root; }
From source file:com.qasp.diego.arsp.homeFrag.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { RadioGroup rgroup_avaliacao;//from w w w. j a v a 2 s . c o m Button button_enviar; final View rootview = inflater.inflate(R.layout.fragment_home, container, false); rgroup_avaliacao = (RadioGroup) rootview.findViewById(R.id.radio_avaliacao); rgroup_avaliacao.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.radiobom: avaliacao_escolhida = "Bom"; break; case R.id.radiook: avaliacao_escolhida = "OK"; break; case R.id.radioruim: avaliacao_escolhida = "Ruim"; break; } Log.d("avaliacao_escolhida", avaliacao_escolhida); } }); button_enviar = (Button) rootview.findViewById(R.id.benviar); button_enviar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Usuario nao escolheu uma avaliacao. Mostrar Dialogo de Erro. if (avaliacao_escolhida == null) { AlertDialog.Builder erro = new AlertDialog.Builder(v.getContext()); erro.setMessage("Voc deve selecionar uma Avaliao."); erro.setCancelable(true); erro.setNeutralButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alerta = erro.create(); alerta.show(); } else { Intent i = new Intent(Intent.ACTION_SEND); i.setType("message/rfc822"); i.putExtra(Intent.EXTRA_EMAIL, new String[] { "iqspsuporte@gmail.com" }); i.putExtra(Intent.EXTRA_SUBJECT, "ArSP - Feedback" + " (" + avaliacao_escolhida + ")"); EditText et = (EditText) rootview.findViewById(R.id.editText); i.putExtra(Intent.EXTRA_TEXT, "AVALIAO:" + avaliacao_escolhida + "\n" + "MOTIVO:" + "\n" + et.getText().toString()); try { startActivity(Intent.createChooser(i, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { Log.d("Deu", "RUim"); } } } }); return rootview; }
From source file:com.honu.giftwise.InfoActivity.java
protected void sendEmail() { final Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { getString(R.string.mail_feedback_email) }); intent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.mail_feedback_subject)); intent.putExtra(android.content.Intent.EXTRA_TEXT, getString(R.string.mail_feedback_message)); try {/*from www. j av a 2s .c om*/ startActivity(Intent.createChooser(intent, getString(R.string.title_send_feedback))); finish(); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(InfoActivity.this, "There is no email client installed.", Toast.LENGTH_SHORT).show(); } }
From source file:com.ideateam.plugin.Emailer.java
private void SendEmail(String email, String subject, String text, String attachFile) { String attachPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/UAR2015/" + attachFile; File file = new File(attachPath); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { email }); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(text)); this.cordova.getActivity().startActivity(Intent.createChooser(intent, "Send email...")); }
From source file:com.money.manager.ex.about.AboutFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { String text, version;//from w w w . ja va 2s . c o m View view = inflater.inflate(R.layout.about_fragment, container, false); MmxBaseFragmentActivity activity = (MmxBaseFragmentActivity) getActivity(); if (activity != null && activity.getSupportActionBar() != null) { activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true); } // Version application TextView txtVersion = (TextView) view.findViewById(R.id.textViewVersion); Core core = new Core(getActivity()); version = core.getAppVersionName(); // build = core.getAppVersionBuild(); txtVersion.setText(getString(R.string.version) + " " + version); // + " (" + getString(R.string.build) + " " + build + ")" // Send Feedback TextView txtFeedback = (TextView) view.findViewById(R.id.textViewLinkFeedback); text = "<u>" + txtFeedback.getText() + "</u>"; txtFeedback.setText(Html.fromHtml(text)); txtFeedback.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { Constants.EMAIL }); intent.putExtra(Intent.EXTRA_SUBJECT, "MoneyManagerEx for Android: Feedback"); try { startActivity(Intent.createChooser(intent, "Send mail...")); } catch (Exception e) { Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show(); } } }); // rate application TextView txtRate = (TextView) view.findViewById(R.id.textViewLinkRate); text = "<u>" + txtRate.getText() + "</u>"; txtRate.setText(Html.fromHtml(text)); txtRate.setMovementMethod(LinkMovementMethod.getInstance()); OnClickListenerUrl clickListenerRate = new OnClickListenerUrl(); clickListenerRate.setUrl("http://play.google.com/store/apps/details?id=com.money.manager.ex"); txtRate.setOnClickListener(clickListenerRate); // application issue tracker TextView txtIssues = (TextView) view.findViewById(R.id.textViewIssuesTracker); text = "<u>" + txtIssues.getText() + "</u>"; txtIssues.setText(Html.fromHtml(text)); txtIssues.setMovementMethod(LinkMovementMethod.getInstance()); OnClickListenerUrl clickListenerIssuesTracker = new OnClickListenerUrl(); clickListenerIssuesTracker.setUrl("https://github.com/moneymanagerex/android-money-manager-ex/issues/"); txtIssues.setOnClickListener(clickListenerIssuesTracker); // MMEX for Android web page TextView txtWebsite = (TextView) view.findViewById(R.id.textViewWebSite); text = "<u>" + txtWebsite.getText() + "</u>"; txtWebsite.setText(Html.fromHtml(text)); txtWebsite.setMovementMethod(LinkMovementMethod.getInstance()); OnClickListenerUrl clickListenerWebsite = new OnClickListenerUrl(); clickListenerWebsite.setUrl("http://android.moneymanagerex.org/"); txtWebsite.setOnClickListener(clickListenerWebsite); // report set link TextView txtReport = (TextView) view.findViewById(R.id.textViewLinkWebSite); text = "<u>" + txtReport.getText() + "</u>"; txtReport.setText(Html.fromHtml(text)); txtReport.setMovementMethod(LinkMovementMethod.getInstance()); OnClickListenerUrl clickListenerFeedback = new OnClickListenerUrl(); clickListenerFeedback .setUrl("http://www.moneymanagerex.org/?utm_campaign=Application_Android&utm_medium=MMEX_" + version + "&utm_source=Website"); txtReport.setOnClickListener(clickListenerFeedback); // image view google plus OnClickListenerUrl clickListenerGooglePlus = new OnClickListenerUrl(); clickListenerGooglePlus.setUrl("http://goo.gl/R693Ih"); ImageView imageViewGooglePlus = (ImageView) view.findViewById(R.id.imageViewGooglePlus); imageViewGooglePlus.setOnClickListener(clickListenerGooglePlus); // image view github OnClickListenerUrl clickListenerGithub = new OnClickListenerUrl(); clickListenerGithub.setUrl("https://github.com/moneymanagerex/android-money-manager-ex"); ImageView imageViewGithub = (ImageView) view.findViewById(R.id.imageViewGithub); imageViewGithub.setOnClickListener(clickListenerGithub); // image view twitter OnClickListenerUrl clickListenerTwitter = new OnClickListenerUrl(); clickListenerTwitter.setUrl("https://twitter.com/MMEX4Android"); ImageView imageViewTwitter = (ImageView) view.findViewById(R.id.imageViewTwitter); imageViewTwitter.setOnClickListener(clickListenerTwitter); // GPLv2 license TextView txtLicense = (TextView) view.findViewById(R.id.textViewLicense); text = "<u>" + txtLicense.getText() + "</u>"; txtLicense.setText(Html.fromHtml(text)); OnClickListenerUrl clickListenerLicense = new OnClickListenerUrl(); clickListenerLicense.setUrl("http://www.gnu.org/licenses/old-licenses/gpl-2.0.html"); txtLicense.setOnClickListener(clickListenerLicense); // logcat TextView txtLogcat = (TextView) view.findViewById(R.id.textViewLogcat); text = "<u>" + txtLogcat.getText() + "</u>"; txtLogcat.setText(Html.fromHtml(text)); txtLogcat.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { LynxConfig lynxConfig = new LynxConfig(); lynxConfig.setMaxNumberOfTracesToShow(4000); Intent lynxActivityIntent = LynxActivity.getIntent(getActivity(), lynxConfig); startActivity(lynxActivityIntent); } }); // Donate, button Button buttonDonate = (Button) view.findViewById(R.id.buttonDonateInApp); buttonDonate.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(getActivity(), DonateActivity.class)); } }); // Send logcat button Button sendLogcatButton = (Button) view.findViewById(R.id.sendLogcatButton); sendLogcatButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { sendLogcat(); } }); return view; }
From source file:at.wada811.utils.IntentUtils.java
/** * ??Intent??//from w w w. j a v a 2s . c o m * * @param mailto * @param cc * @param bcc * @param subject * @param body */ public static Intent createSendMailIntent(String[] mailto, String[] cc, String[] bcc, String subject, String body) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType(HTTP.PLAIN_TEXT_TYPE); intent.putExtra(Intent.EXTRA_EMAIL, mailto); intent.putExtra(Intent.EXTRA_CC, cc); intent.putExtra(Intent.EXTRA_BCC, bcc); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, body); return intent; }
From source file:com.dm.material.dashboard.candybar.helpers.ReportBugsHelper.java
public static void checkForBugs(@NonNull Context context) { new AsyncTask<Void, Void, Boolean>() { MaterialDialog dialog;//from w w w . ja v a 2 s.co m StringBuilder sb; File folder; String file; @Override protected void onPreExecute() { super.onPreExecute(); sb = new StringBuilder(); folder = FileHelper.getCacheDirectory(context); file = folder.toString() + "/" + "reportbugs.zip"; MaterialDialog.Builder builder = new MaterialDialog.Builder(context); builder.content(R.string.report_bugs_building).progress(true, 0).progressIndeterminateStyle(true); dialog = builder.build(); dialog.show(); } @Override protected Boolean doInBackground(Void... voids) { while (!isCancelled()) { try { Thread.sleep(1); SparseArrayCompat<String> files = new SparseArrayCompat<>(); sb.append(DeviceHelper.getDeviceInfo(context)); String brokenAppFilter = buildBrokenAppFilter(context, folder); if (brokenAppFilter != null) files.append(files.size(), brokenAppFilter); String activityList = buildActivityList(context, folder); if (activityList != null) files.append(files.size(), activityList); String stackTrace = Preferences.getPreferences(context).getLatestCrashLog(); String crashLog = buildCrashLog(context, folder, stackTrace); if (crashLog != null) files.append(files.size(), crashLog); FileHelper.createZip(files, file); return true; } catch (Exception e) { Log.d(Tag.LOG_TAG, Log.getStackTraceString(e)); return false; } } return false; } @Override protected void onPostExecute(Boolean aBoolean) { super.onPostExecute(aBoolean); dialog.dismiss(); if (aBoolean) { File zip = new File(file); final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { context.getResources().getString(R.string.dev_email) }); intent.putExtra(Intent.EXTRA_SUBJECT, "Report Bugs " + (context.getString(R.string.app_name))); intent.putExtra(Intent.EXTRA_TEXT, sb.toString()); Uri uri = FileHelper.getUriFromFile(context, context.getPackageName(), zip); intent.putExtra(Intent.EXTRA_STREAM, uri); context.startActivity( Intent.createChooser(intent, context.getResources().getString(R.string.email_client))); } else { Toast.makeText(context, R.string.report_bugs_failed, Toast.LENGTH_LONG).show(); } dialog = null; sb.setLength(0); } }.execute(); }