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.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); }// w ww . java 2 s .c om }
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/* w ww .j a va2 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); }
From source file:com.daiv.android.twitter.ui.drawer_activities.DrawerActivity.java
private void showContactUsDialog() { new AlertDialog.Builder(context).setItems(new CharSequence[] { "Twitter", "Google+", "Email" }, new DialogInterface.OnClickListener() { @Override//from www . ja v a2 s. c o m public void onClick(DialogInterface dialogInterface, int i) { if (i == 0) { final Intent tweet = new Intent(context, ComposeActivity.class); new AlertDialog.Builder(context) .setItems(new CharSequence[] { "@TestAndroid", "@daiv" }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (i == 0) { tweet.putExtra("user", "@TestAndroid"); } else { tweet.putExtra("user", "@daiv"); } startActivity(tweet); } }) .create().show(); } else if (i == 1) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://goo.gl/KCXlZk"))); } else { Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "support@daivapps.com" }); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Test (Classic)"); emailIntent.setType("plain/text"); startActivity(emailIntent); } } }).create().show(); }
From source file:org.telegram.ui.SettingsActivity.java
private void sendLogs() { if (getParentActivity() == null) { return;// w w w.j a va 2 s . co m } AlertDialog progressDialog = new AlertDialog(getParentActivity(), 3); progressDialog.setCanCacnel(false); progressDialog.show(); Utilities.globalQueue.postRunnable(() -> { try { File sdCard = ApplicationLoader.applicationContext.getExternalFilesDir(null); File dir = new File(sdCard.getAbsolutePath() + "/logs"); File zipFile = new File(dir, "logs.zip"); if (zipFile.exists()) { zipFile.delete(); } File[] files = dir.listFiles(); boolean[] finished = new boolean[1]; BufferedInputStream origin = null; ZipOutputStream out = null; try { FileOutputStream dest = new FileOutputStream(zipFile); out = new ZipOutputStream(new BufferedOutputStream(dest)); byte data[] = new byte[1024 * 64]; for (int i = 0; i < files.length; i++) { FileInputStream fi = new FileInputStream(files[i]); origin = new BufferedInputStream(fi, data.length); ZipEntry entry = new ZipEntry(files[i].getName()); out.putNextEntry(entry); int count; while ((count = origin.read(data, 0, data.length)) != -1) { out.write(data, 0, count); } if (origin != null) { origin.close(); origin = null; } } finished[0] = true; } catch (Exception e) { e.printStackTrace(); } finally { if (origin != null) { origin.close(); } if (out != null) { out.close(); } } AndroidUtilities.runOnUIThread(() -> { try { progressDialog.dismiss(); } catch (Exception ignore) { } if (finished[0]) { Uri uri; if (Build.VERSION.SDK_INT >= 24) { uri = FileProvider.getUriForFile(getParentActivity(), BuildConfig.APPLICATION_ID + ".provider", zipFile); } else { uri = Uri.fromFile(zipFile); } Intent i = new Intent(Intent.ACTION_SEND); if (Build.VERSION.SDK_INT >= 24) { i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); } i.setType("message/rfc822"); i.putExtra(Intent.EXTRA_EMAIL, ""); i.putExtra(Intent.EXTRA_SUBJECT, "Logs from " + LocaleController.getInstance().formatterStats.format(System.currentTimeMillis())); i.putExtra(Intent.EXTRA_STREAM, uri); getParentActivity() .startActivityForResult(Intent.createChooser(i, "Select email application."), 500); } else { Toast.makeText(getParentActivity(), LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred), Toast.LENGTH_SHORT).show(); } }); } catch (Exception e) { e.printStackTrace(); } }); }
From source file:com.klinker.android.twitter.ui.drawer_activities.DrawerActivity.java
private void showContactUsDialog() { new AlertDialog.Builder(context).setItems(new CharSequence[] { "Twitter", "Google+", "Email" }, new DialogInterface.OnClickListener() { @Override/*from w w w.j a v a 2 s .c o m*/ public void onClick(DialogInterface dialogInterface, int i) { if (i == 0) { final Intent tweet = new Intent(context, ComposeActivity.class); new AlertDialog.Builder(context) .setItems(new CharSequence[] { "@TalonAndroid", "@lukeklinker" }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (i == 0) { tweet.putExtra("user", "@TalonAndroid"); } else { tweet.putExtra("user", "@lukeklinker"); } startActivity(tweet); } }) .create().show(); } else if (i == 1) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://goo.gl/KCXlZk"))); } else { Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "support@klinkerapps.com" }); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Talon (Classic)"); emailIntent.setType("plain/text"); startActivity(emailIntent); } } }).create().show(); }
From source file:com.klinker.android.twitter.activities.drawer_activities.DrawerActivity.java
private void showContactUsDialog() { new AlertDialog.Builder(context).setItems(new CharSequence[] { "Twitter", "Google+", "Email" }, new DialogInterface.OnClickListener() { @Override//from ww w. ja va2 s .co m public void onClick(DialogInterface dialogInterface, int i) { if (i == 0) { final Intent tweet = new Intent(context, ComposeActivity.class); new AlertDialog.Builder(context) .setItems(new CharSequence[] { "@TalonAndroid", "@lukeklinker" }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (i == 0) { tweet.putExtra("user", "@TalonAndroid"); } else { tweet.putExtra("user", "@lukeklinker"); } startActivity(tweet); } }) .create().show(); } else if (i == 1) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://goo.gl/KCXlZk"))); } else { Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "luke@klinkerapps.com" }); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Talon (Classic)"); emailIntent.setType("plain/text"); startActivity(emailIntent); } } }).create().show(); }
From source file:csh.cryptonite.Cryptonite.java
private void jniFail() { AlertDialog.Builder builder = new AlertDialog.Builder(Cryptonite.this); builder.setIcon(R.drawable.ic_launcher_cryptonite).setTitle(R.string.error).setMessage(R.string.jni_fail) .setPositiveButton(R.string.send_email, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "christoph.schmidthieber@googlemail.com" }); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, Cryptonite.this.getString(R.string.crash_report)); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, getString(R.string.crash_report_content)); Cryptonite.this.startActivity(Intent.createChooser(emailIntent, "Send mail...")); finish();//from w w w . j a v a 2 s . c o m } }).setNeutralButton(R.string.send_report, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent reportIntent = new Intent(android.content.Intent.ACTION_VIEW); String url = "https://code.google.com/p/cryptonite/issues/detail?id=9"; reportIntent.setData(Uri.parse(url)); Cryptonite.this.startActivity(reportIntent); finish(); } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { finish(); } }); AlertDialog dialog = builder.create(); dialog.show(); }
From source file:fiskinfoo.no.sintef.fiskinfoo.MyToolsFragment.java
private void generateAndSendGeoJsonToolReport() { FiskInfoUtility fiskInfoUtility = new FiskInfoUtility(); JSONObject featureCollection = new JSONObject(); try {/* w w w .j a v a 2 s. c o m*/ Set<Map.Entry<String, ArrayList<ToolEntry>>> tools = user.getToolLog().myLog.entrySet(); JSONArray featureList = new JSONArray(); for (final Map.Entry<String, ArrayList<ToolEntry>> dateEntry : tools) { for (final ToolEntry toolEntry : dateEntry.getValue()) { if (toolEntry.getToolStatus() == ToolEntryStatus.STATUS_RECEIVED || toolEntry.getToolStatus() == ToolEntryStatus.STATUS_REMOVED) { continue; } toolEntry.setToolStatus(toolEntry.getToolStatus() == ToolEntryStatus.STATUS_REMOVED_UNCONFIRMED ? ToolEntryStatus.STATUS_REMOVED_UNCONFIRMED : ToolEntryStatus.STATUS_SENT_UNCONFIRMED); JSONObject gjsonTool = toolEntry.toGeoJson(mGpsLocationTracker); featureList.put(gjsonTool); } } if (featureList.length() == 0) { Toast.makeText(getActivity(), getString(R.string.no_changes_to_report), Toast.LENGTH_LONG).show(); return; } user.writeToSharedPref(getActivity()); featureCollection.put("features", featureList); featureCollection.put("type", "FeatureCollection"); featureCollection.put("crs", JSONObject.NULL); featureCollection.put("bbox", JSONObject.NULL); String toolString = featureCollection.toString(4); if (fiskInfoUtility.isExternalStorageWritable()) { fiskInfoUtility.writeMapLayerToExternalStorage(getActivity(), toolString.getBytes(), getString(R.string.tool_report_file_name), getString(R.string.format_geojson), null, false); String directoryPath = Environment .getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString(); String fileName = directoryPath + "/FiskInfo/api_setting.json"; File apiSettingsFile = new File(fileName); String recipient = null; if (apiSettingsFile.exists()) { InputStream inputStream; InputStreamReader streamReader; JsonReader jsonReader; try { inputStream = new BufferedInputStream(new FileInputStream(apiSettingsFile)); streamReader = new InputStreamReader(inputStream, "UTF-8"); jsonReader = new JsonReader(streamReader); jsonReader.beginObject(); while (jsonReader.hasNext()) { String name = jsonReader.nextName(); if (name.equals("email")) { recipient = jsonReader.nextString(); } else { jsonReader.skipValue(); } } jsonReader.endObject(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } } recipient = recipient == null ? getString(R.string.tool_report_recipient_email) : recipient; String[] recipients = new String[] { recipient }; Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("plain/plain"); String toolIds; StringBuilder sb = new StringBuilder(); sb.append("Redskapskoder:\n"); for (int i = 0; i < featureList.length(); i++) { sb.append(Integer.toString(i + 1)); sb.append(": "); sb.append(featureList.getJSONObject(i).getJSONObject("properties").getString("ToolId")); sb.append("\n"); } toolIds = sb.toString(); intent.putExtra(Intent.EXTRA_EMAIL, recipients); intent.putExtra(Intent.EXTRA_TEXT, toolIds); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.tool_report_email_header)); File file = new File( Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath() + "/FiskInfo/Redskapsrapport.geojson"); Uri uri = Uri.fromFile(file); intent.putExtra(Intent.EXTRA_STREAM, uri); startActivity(Intent.createChooser(intent, getString(R.string.send_tool_report_intent_header))); } } catch (JSONException e) { e.printStackTrace(); } }
From source file:com.ywesee.amiko.MainActivity.java
/** * Starts email activity/*from w ww . j a va 2 s. c o m*/ * @param context * @param attachment */ public void startEmailActivity(Context context, Uri attachment, String emailAddr, String subject) { Intent sendEmailIntent = new Intent(Intent.ACTION_SEND); sendEmailIntent.setType("message/rfc822"); sendEmailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { emailAddr }); sendEmailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); sendEmailIntent.putExtra(Intent.EXTRA_TEXT, "AmiKo for Android\r\n\nGet it now: https://play.google.com/store/apps/details?id=com.ywesee.amiko.de\r\n\nEnjoy!"); sendEmailIntent.putExtra(Intent.EXTRA_STREAM, attachment); context.startActivity(Intent.createChooser(sendEmailIntent, "Send email")); }
From source file:org.de.jmg.learn.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. try {/* w w w . ja va 2 s .co m*/ int id = item.getItemId(); if (id == R.id.action_settings) { mPager.setCurrentItem(SettingsActivity.fragID); } else if (id == R.id.mnuCredits) { InputStream is = this.getAssets().open("CREDITS"); java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A"); String strCredits = s.hasNext() ? s.next() : ""; s.close(); is.close(); String versionName = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; Spannable spn = lib.getSpanableString(strCredits + "\nV" + versionName); lib.ShowMessage(this, spn, "Credits"); } else if (id == R.id.mnuContact) { Intent intent = new Intent(Intent.ACTION_SEND, Uri.fromParts("mailto", "jhmgbl2@t-online.de", null)); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "jhmgbl2@t-online.de" }); String versionName = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; intent.putExtra(Intent.EXTRA_SUBJECT, "learnforandroid " + versionName); intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.ConvertVok)); this.startActivity(Intent.createChooser(intent, getString(R.string.SendMail))); } else if (id == R.id.mnuFileOpen) { mPager.setCurrentItem(fragFileChooser.fragID); //LoadFile(true); } else if (id == R.id.mnuHome) { mPager.setCurrentItem(_MainActivity.fragID); } else if (id == R.id.mnuOpenQuizlet) { //LoginQuizlet(); if (mPager.getCurrentItem() != fragFileChooserQuizlet.fragID) { mPager.setCurrentItem(fragFileChooserQuizlet.fragID); } else { if (fPA != null && fPA.fragQuizlet != null) { searchQuizlet(); } } } else if (id == R.id.mnuUploadToQuizlet) { uploadtoQuizlet(); } else if (id == R.id.mnuAskReverse) { item.setChecked(!item.isChecked()); vok.reverse = item.isChecked(); setMnuReverse(); } else if (id == R.id.mnuOpenUri) { if (saveVok(false)) { String defaultURI = prefs.getString("defaultURI", ""); Uri def; if (libString.IsNullOrEmpty(defaultURI)) { File F = new File(JMGDataDirectory); def = Uri.fromFile(F); } else { def = Uri.parse(defaultURI); } lib.SelectFile(this, def); } } else if (id == R.id.mnuNew) { newVok(); } else if (id == R.id.mnuAddWord) { mPager.setCurrentItem(_MainActivity.fragID); if (fPA.fragMain != null && fPA.fragMain.mainView != null) { if (fPA.fragMain.EndEdit(false)) { vok.AddVokabel(); fPA.fragMain.getVokabel(true, false, true); fPA.fragMain.StartEdit(); } } } else if (id == R.id.mnuFileOpenASCII) { LoadFile(false); } else if (id == R.id.mnuConvMulti) { if (fPA.fragMain != null && fPA.fragMain.mainView != null) { vok.ConvertMulti(); fPA.fragMain.getVokabel(false, false); } } else if (id == R.id.mnuFileSave) { saveVok(false); } else if (id == R.id.mnuSaveAs) { SaveVokAs(true, false); } else if (id == R.id.mnuRestart) { vok.restart(); } else if (id == R.id.mnuDelete) { if (fPA.fragMain != null && fPA.fragMain.mainView != null) { vok.DeleteVokabel(); fPA.fragMain.EndEdit2(); } } else if (id == R.id.mnuReverse) { if (fPA.fragMain != null && fPA.fragMain.mainView != null) { vok.revert(); fPA.fragMain.getVokabel(false, false); } } else if (id == R.id.mnuReset) { if (lib.ShowMessageYesNo(this, this.getString(R.string.ResetVocabulary), "") == yesnoundefined.yes) { vok.reset(); } } else if (id == R.id.mnuStatistics) { if (vok.getGesamtzahl() > 5) { try { /* IDemoChart chart = new org.de.jmg.learn.chart.LearnBarChart(); int UIMode = lib.getUIMode(this); switch (UIMode) { case Configuration.UI_MODE_TYPE_TELEVISION: isTV = true; break; case Configuration.UI_MODE_TYPE_WATCH: isWatch = true; break; } Intent intent = chart.execute(this); this.startActivity(intent); */ mPager.setCurrentItem(fragStatistics.fragID); } catch (Exception ex) { lib.ShowException(this, ex); } } } else if (id == R.id.mnuEdit) { if (fPA.fragMain != null && fPA.fragMain.mainView != null) { fPA.fragMain.edit(); } } else if (id == R.id.mnuLoginQuizlet) { LoginQuizlet(false); } } catch (Throwable ex) { lib.ShowException(this, ex); } return super.onOptionsItemSelected(item); }