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:ch.luklanis.esscan.history.HistoryActivity.java
private Intent createShareIntent(String mime, Uri dtaFileUri) { String[] recipients = new String[] { PreferenceManager.getDefaultSharedPreferences(this) .getString(PreferencesActivity.KEY_EMAIL_ADDRESS, "") }; String subject = getResources().getString(R.string.history_share_as_dta_title); String text = String.format(getResources().getString(R.string.history_share_as_dta_summary), dtaFileUri.getPath());/*from w w w . ja v a 2 s . c o m*/ Intent intent = new Intent(Intent.ACTION_SEND, Uri.parse("mailto:")); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.setType(mime); intent.putExtra(Intent.EXTRA_EMAIL, recipients); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, text); intent.putExtra(Intent.EXTRA_STREAM, dtaFileUri); return intent; }
From source file:eu.funceptionapps.convertitall.ui.ConverterInterface.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { if (mDrawerLayout.isDrawerOpen(mDrawerList)) { mDrawerLayout.closeDrawer(mDrawerList); } else {/*from w w w . j av a 2 s . c o m*/ mDrawerLayout.openDrawer(mDrawerList); } } switch (item.getItemId()) { case R.id.homeAsUp: return true; case R.id.menu_item_copy: EditText edResult = (EditText) findViewById(R.id.ed_unitOut); ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setText(edResult.getText().toString()); Toast.makeText(this, getResources().getString(R.string.toast_copy_to_clipboard), Toast.LENGTH_SHORT) .show(); break; case R.id.menu_item_favorite: makeFavoriteDialog(); break; case R.id.menu_item_update_currencies: makeUpdateDialog(); break; case R.id.menu_item_settings: Intent intent = new Intent(this, SettingsInterface.class); startActivityForResult(intent, settingsRequestCode); break; case R.id.menu_item_share: if (mShareActionProvider != null) { sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, sharingMsg); sendIntent.setType("text/plain"); mShareActionProvider.setShareIntent(sendIntent); } break; case R.id.menu_item_feedback: Intent feedback = new Intent(); feedback.setAction(Intent.ACTION_SEND); String gmail = getResources().getString(R.string.gmail); String[] recipients = new String[] { gmail, "", }; feedback.putExtra(Intent.EXTRA_EMAIL, recipients); feedback.putExtra(Intent.EXTRA_SUBJECT, "Feedback"); feedback.setType("message/rfc822"); startActivity(feedback); break; } return true; }
From source file:net.gsantner.opoc.util.ShareUtil.java
/** * Draft an email with given data. Unknown data can be supplied as null. * This will open a chooser with installed mail clients where the mail can be sent from * * @param subject Subject (top/title) text to be prefilled in the mail * @param body Body (content) text to be prefilled in the mail * @param to recipients to be prefilled in the mail *///w ww . ja va 2 s.c o m public void draftEmail(String subject, String body, String... to) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:")); if (subject != null) { intent.putExtra(Intent.EXTRA_SUBJECT, subject); } if (body != null) { intent.putExtra(Intent.EXTRA_TEXT, body); } if (to != null && to.length > 0 && to[0] != null) { intent.putExtra(Intent.EXTRA_EMAIL, to); } showChooser(intent, null); }
From source file:com.ibuildapp.romanblack.MultiContactsPlugin.ContactDetailsActivity.java
/** * Opens a contact detial pare depending on contact type. * * @param position contact position/*from w ww .j av a 2s . c om*/ */ private void listViewItemClick(int position) { try {//ErrorLogging int type = neededContacts.get(position).getType(); switch (type) { case 0: { } break; case 1: { final String phoneNumber = neededContacts.get(position).getDescription(); new CallDialog(this, phoneNumber, new CallDialog.ActionListener() { @Override public void onCall(DialogInterface dialog) { dialog.dismiss(); Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:" + phoneNumber)); startActivity(callIntent); overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale); } @Override public void onAddContact(DialogInterface dialog) { createNewContact(person.getName(), person.getPhone(), person.getEmail()); dialog.dismiss(); } @Override public void onCancel(DialogInterface dialog) { dialog.dismiss(); } }).show(); } break; case 2: { String email = neededContacts.get(position).getDescription(); Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("text/html"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { email }); startActivity(emailIntent); overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale); } break; case 3: { String url = neededContacts.get(position).getDescription(); if (!url.startsWith("http://") && !url.startsWith("https://")) { url = "http://" + url; } Intent intent = new Intent(this, ContactsWebActivity.class); intent.putExtra("link", url); startActivity(intent); overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale); } break; case 4: { Intent intent = new Intent(this, NativeMapActivity.class); intent.putExtra("person", person); startActivity(intent); overridePendingTransition(R.anim.activity_open_translate, R.anim.activity_close_scale); } break; } } catch (Exception e) { Log.e(TAG, e.getMessage()); e.printStackTrace(); } }
From source file:io.v.moments.ux.MainActivity.java
@Override public void onSensorChanged(SensorEvent event) { float gX = event.values[0] / SensorManager.GRAVITY_EARTH; float gY = event.values[1] / SensorManager.GRAVITY_EARTH; float gZ = event.values[2] / SensorManager.GRAVITY_EARTH; double gForce = Math.sqrt(gX * gX + gY * gY + gZ * gZ); if (gForce < SHAKE_THRESHOLD) { return;//ww w. j a va 2s . c om } final long now = System.currentTimeMillis(); if (now - mShakeTimestamp < SHAKE_EVENT_MS) { return; } mShakeTimestamp = now; final EditText invitee = new EditText(this); invitee.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); AlertDialog.Builder builder = new AlertDialog.Builder(this) .setTitle(getString(R.string.invite_remote_inspector)).setView(invitee) .setPositiveButton(getString(R.string.invite_remote_inspector_positive_button), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(Intent.ACTION_SEND); String to = invitee.getText().toString(); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { to }); intent.putExtra(Intent.EXTRA_SUBJECT, "Please help me debug"); try { intent.putExtra(Intent.EXTRA_TEXT, mV23Manager.inviteInspector(to, Duration.standardDays(1))); mRemoteInspectionEnabled = true; } catch (Exception e) { toast(e.toString()); return; } if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { toast(getString(R.string.invite_remote_inspector_failed)); } } }) .setNegativeButton(getString(R.string.invite_remote_inspector_negative_button), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); if (mRemoteInspectionEnabled) { builder.setNeutralButton(getString(R.string.invite_remote_inspector_neutral_button), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // This doesn't take effect till the next time the activity is created // (invited users will still be able to connect till then). mRemoteInspectionEnabled = false; } }); } builder.show(); }
From source file:com.shurik.droidzebra.ZebraActivity.java
private void sendMail() { //GetNowTime//from w ww . j a va 2 s.c o m Calendar calendar = Calendar.getInstance(); Date nowTime = calendar.getTime(); StringBuilder sbBlackPlayer = new StringBuilder(); StringBuilder sbWhitePlayer = new StringBuilder(); ZebraEngine.GameState gs = mZebraThread.getGameState(); SharedPreferences settings = getSharedPreferences(Constants.SHARED_PREFS_NAME, 0); byte[] moves = null; if (gs != null) { moves = gs.mMoveSequence; } Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { settings.getString(SETTINGS_KEY_SENDMAIL, DEFAULT_SETTING_SENDMAIL) }); intent.putExtra(Intent.EXTRA_SUBJECT, "ZebraActivity"); //get BlackPlayer and WhitePlayer switch (mSettingFunction) { case FUNCTION_HUMAN_VS_HUMAN: sbBlackPlayer.append("Player"); sbWhitePlayer.append("Player"); break; case FUNCTION_ZEBRA_BLACK: sbBlackPlayer.append("ZebraActivity-"); sbBlackPlayer.append(mSettingZebraDepth); sbBlackPlayer.append("/"); sbBlackPlayer.append(mSettingZebraDepthExact); sbBlackPlayer.append("/"); sbBlackPlayer.append(mSettingZebraDepthWLD); sbWhitePlayer.append("Player"); break; case FUNCTION_ZEBRA_WHITE: sbBlackPlayer.append("Player"); sbWhitePlayer.append("ZebraActivity-"); sbWhitePlayer.append(mSettingZebraDepth); sbWhitePlayer.append("/"); sbWhitePlayer.append(mSettingZebraDepthExact); sbWhitePlayer.append("/"); sbWhitePlayer.append(mSettingZebraDepthWLD); break; case FUNCTION_ZEBRA_VS_ZEBRA: sbBlackPlayer.append("ZebraActivity-"); sbBlackPlayer.append(mSettingZebraDepth); sbBlackPlayer.append("/"); sbBlackPlayer.append(mSettingZebraDepthExact); sbBlackPlayer.append("/"); sbBlackPlayer.append(mSettingZebraDepthWLD); sbWhitePlayer.append("ZebraActivity-"); sbWhitePlayer.append(mSettingZebraDepth); sbWhitePlayer.append("/"); sbWhitePlayer.append(mSettingZebraDepthExact); sbWhitePlayer.append("/"); sbWhitePlayer.append(mSettingZebraDepthWLD); default: } StringBuilder sb = new StringBuilder(); sb.append(getResources().getString(R.string.mail_generated)); sb.append("\r\n"); sb.append(getResources().getString(R.string.mail_date)); sb.append(" "); sb.append(nowTime); sb.append("\r\n\r\n"); sb.append(getResources().getString(R.string.mail_move)); sb.append(" "); StringBuffer sbMoves = new StringBuffer(); if (moves != null) { for (byte move1 : moves) { if (move1 != 0x00) { Move move = new Move(move1); sbMoves.append(move.getText()); if (mLastMove.getText().equals(move.getText())) { break; } } } } sb.append(sbMoves); sb.append("\r\n\r\n"); sb.append(sbBlackPlayer.toString()); sb.append(" (B) "); sb.append(mBlackScore); sb.append(":"); sb.append(mWhiteScore); sb.append(" (W) "); sb.append(sbWhitePlayer.toString()); sb.append("\r\n\r\n"); sb.append(getResources().getString(R.string.mail_url)); sb.append("\r\n"); sb.append(getResources().getString(R.string.mail_viewer_url)); sb.append("lm="); sb.append(sbMoves); sb.append("&bp="); sb.append(sbBlackPlayer.toString()); sb.append("&wp="); sb.append(sbWhitePlayer.toString()); sb.append("&bs="); sb.append(mBlackScore); sb.append("&ws="); sb.append(mWhiteScore); intent.putExtra(Intent.EXTRA_TEXT, sb.toString()); // Intent this.startActivity(intent); }
From source file:org.brandroid.openmanager.fragments.DialogHandler.java
public static void showAboutDialog(final Context mContext) { LayoutInflater li = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = li.inflate(R.layout.about, null); String sVersionInfo = ""; try {/*from w w w. j a v a 2s.c o m*/ PackageInfo pi = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0); sVersionInfo += pi.versionName; if (!pi.versionName.contains("" + pi.versionCode)) sVersionInfo += " (" + pi.versionCode + ")"; if (OpenExplorer.IS_DEBUG_BUILD) sVersionInfo += " *debug*"; } catch (NameNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } String sBuildTime = ""; try { sBuildTime = SimpleDateFormat.getInstance() .format(new Date(new ZipFile( mContext.getPackageManager().getApplicationInfo(mContext.getPackageName(), 0).sourceDir) .getEntry("classes.dex").getTime())); } catch (Exception e) { Logger.LogError("Couldn't get Build Time.", e); } WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics dm = new DisplayMetrics(); wm.getDefaultDisplay().getMetrics(dm); Display d = wm.getDefaultDisplay(); String sHardwareInfo = "Display:\n"; sHardwareInfo += "Size: " + d.getWidth() + "x" + d.getHeight() + "\n"; if (dm != null) sHardwareInfo += "Density: " + dm.density + "\n"; sHardwareInfo += "Rotation: " + d.getRotation() + "\n\n"; sHardwareInfo += getNetworkInfo(mContext); sHardwareInfo += getDeviceInfo(); ((TextView) view.findViewById(R.id.about_hardware)).setText(sHardwareInfo); final String sSubject = "Feedback for OpenExplorer " + sVersionInfo; OnClickListener email = new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); //intent.addCategory(Intent.CATEGORY_APP_EMAIL); intent.putExtra(android.content.Intent.EXTRA_TEXT, "\n" + getDeviceInfo()); intent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "brandroid64@gmail.com" }); intent.putExtra(android.content.Intent.EXTRA_SUBJECT, sSubject); mContext.startActivity(Intent.createChooser(intent, mContext.getString(R.string.s_chooser_email))); } }; OnClickListener viewsite = new OnClickListener() { public void onClick(View v) { mContext.startActivity( new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("http://brandroid.org/open/"))); } }; view.findViewById(R.id.about_email).setOnClickListener(email); view.findViewById(R.id.about_email_btn).setOnClickListener(email); view.findViewById(R.id.about_site).setOnClickListener(viewsite); view.findViewById(R.id.about_site_btn).setOnClickListener(viewsite); final View mRecentLabel = view.findViewById(R.id.about_recent_status_label); final WebView mRecent = (WebView) view.findViewById(R.id.about_recent); final OpenChromeClient occ = new OpenChromeClient(); occ.mStatus = (TextView) view.findViewById(R.id.about_recent_status); mRecent.setWebChromeClient(occ); mRecent.setWebViewClient(new WebViewClient() { @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { occ.mStatus.setVisibility(View.GONE); mRecent.setVisibility(View.GONE); mRecentLabel.setVisibility(View.GONE); } }); mRecent.setBackgroundColor(Color.TRANSPARENT); mRecent.loadUrl("http://brandroid.org/open/?show=recent"); ((TextView) view.findViewById(R.id.about_version)).setText(sVersionInfo); if (sBuildTime != "") ((TextView) view.findViewById(R.id.about_buildtime)).setText(sBuildTime); else ((TableRow) view.findViewById(R.id.row_buildtime)).setVisibility(View.GONE); fillShortcutsTable((TableLayout) view.findViewById(R.id.shortcuts_table)); final View tab1 = view.findViewById(R.id.tab1); final View tab2 = view.findViewById(R.id.tab2); final View tab3 = view.findViewById(R.id.tab3); ((Button) view.findViewById(R.id.btn_recent)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { tab1.setVisibility(View.VISIBLE); tab2.setVisibility(View.GONE); tab3.setVisibility(View.GONE); } }); ((Button) view.findViewById(R.id.btn_hardware)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { tab1.setVisibility(View.GONE); tab2.setVisibility(View.VISIBLE); tab3.setVisibility(View.GONE); } }); ((Button) view.findViewById(R.id.btn_shortcuts)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { tab1.setVisibility(View.GONE); tab2.setVisibility(View.GONE); tab3.setVisibility(View.VISIBLE); } }); AlertDialog mDlgAbout = new AlertDialog.Builder(mContext).setTitle(R.string.app_name).setView(view) .create(); mDlgAbout.getWindow().getAttributes().windowAnimations = R.style.SlideDialogAnimation; mDlgAbout.getWindow().getAttributes().alpha = 0.9f; mDlgAbout.show(); }
From source file:com.sentaroh.android.Utilities.LogUtil.CommonLogFileListDialogFragment.java
final public void sendLogFileToDeveloper(String log_file_path) { CommonLogUtil.resetLogReceiver(mContext, mGp); String zip_file_name = mGp.getLogDirName() + "log.zip"; File lf = new File(zip_file_name); lf.delete();// www . jav a 2s. c o m // createZipFile(zip_file_name,log_file_path); String[] lmp = LocalMountPoint.convertFilePathToMountpointFormat(mContext, log_file_path); ZipUtil.createZipFile(mContext, null, null, zip_file_name, lmp[0], log_file_path); Intent intent = new Intent(); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(Intent.ACTION_SEND); // intent.setType("message/rfc822"); // intent.setType("text/plain"); intent.setType("application/zip"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "gm.developer.fhoshino@gmail.com" }); // intent.putExtra(Intent.EXTRA_CC, new String[]{"cc@example.com"}); // intent.putExtra(Intent.EXTRA_BCC, new String[]{"bcc@example.com"}); intent.putExtra(Intent.EXTRA_SUBJECT, "Log file"); intent.putExtra(Intent.EXTRA_TEXT, "Any comment"); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(lf)); mContext.startActivity(intent); }
From source file:free.yhc.netmbuddy.utils.Utils.java
public static void sendMail(Context context, String receiver, String subject, String text, File attachment) { if (!Utils.isNetworkAvailable()) return;/* www .ja v a 2 s . c o m*/ Intent intent = new Intent(Intent.ACTION_SEND); if (null != receiver) intent.putExtra(Intent.EXTRA_EMAIL, new String[] { receiver }); intent.putExtra(Intent.EXTRA_TEXT, text); intent.putExtra(Intent.EXTRA_SUBJECT, subject); if (null != attachment) intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(attachment)); intent.setType("message/rfc822"); try { context.startActivity(intent); } catch (ActivityNotFoundException e) { UiUtils.showTextToast(context, R.string.msg_fail_find_app); } }
From source file:com.sweetiepiggy.raspberrybusmalaysia.SubmitTripActivity.java
private void send_email(String msg) { Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { EMAIL_ADDRESS }); intent.putExtra(Intent.EXTRA_SUBJECT, EMAIL_SUBJECT); intent.putExtra(Intent.EXTRA_TEXT, msg); intent.setType("text/plain"); startActivity(Intent.createChooser(intent, getResources().getString(R.string.send_email))); }