List of usage examples for android.content Intent ACTION_SENDTO
String ACTION_SENDTO
To view the source code for android.content Intent ACTION_SENDTO.
Click Source Link
From source file:org.schabi.newpipe.report.ErrorActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ThemeHelper.setTheme(this, true); setContentView(R.layout.activity_error); Intent intent = getIntent();//from w w w .j a va 2 s. co m try { ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(R.string.error_report_title); actionBar.setDisplayShowTitleEnabled(true); } catch (Throwable e) { Log.e(TAG, "Error turing exception handling"); e.printStackTrace(); } reportButton = (Button) findViewById(R.id.errorReportButton); userCommentBox = (EditText) findViewById(R.id.errorCommentBox); errorView = (TextView) findViewById(R.id.errorView); infoView = (TextView) findViewById(R.id.errorInfosView); errorMessageView = (TextView) findViewById(R.id.errorMessageView); ActivityCommunicator ac = ActivityCommunicator.getCommunicator(); returnActivity = ac.returnActivity; errorInfo = intent.getParcelableExtra(ERROR_INFO); errorList = intent.getStringArrayExtra(ERROR_LIST); //importand add gurumeditaion addGuruMeditaion(); currentTimeStamp = getCurrentTimeStamp(); reportButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:" + ERROR_EMAIL_ADDRESS)) .putExtra(Intent.EXTRA_SUBJECT, ERROR_EMAIL_SUBJECT) .putExtra(Intent.EXTRA_TEXT, buildJson()); startActivity(Intent.createChooser(intent, "Send Email")); } }); reportButton.setEnabled(false); globIpRangeThread = new Thread(new IpRagneRequester()); globIpRangeThread.start(); // normal bugreport buildInfo(errorInfo); if (errorInfo.message != 0) { errorMessageView.setText(errorInfo.message); } else { errorMessageView.setVisibility(View.GONE); findViewById(R.id.messageWhatHappenedView).setVisibility(View.GONE); } errorView.setText(formErrorText(errorList)); //print stack trace once again for debugging: for (String e : errorList) { Log.e(TAG, e); } }
From source file:de.ub0r.android.websms.WebSMSReceiver.java
/** * Displays notification if sending failed * * @param context context//from ww w. j a va 2 s . co m * @param specs {@link de.ub0r.android.websms.connector.common.ConnectorSpec} * @param command {@link de.ub0r.android.websms.connector.common.ConnectorCommand} */ private static void displaySendingFailedNotification(final Context context, final ConnectorSpec specs, final ConnectorCommand command) { final SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(context); String to = Utils.joinRecipients(command.getRecipients(), ", "); final Intent i = new Intent(Intent.ACTION_SENDTO, Uri.parse(INTENT_SCHEME_SMSTO + ":" + Uri.encode(to)), context, WebSMS.class); // add pending intent i.putExtra(Intent.EXTRA_TEXT, command.getText()); i.putExtra(WebSMS.EXTRA_ERRORMESSAGE, specs.getErrorMessage()); i.setFlags(i.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK); final PendingIntent cIntent = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_CANCEL_CURRENT); NotificationCompat.Builder b = new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.stat_notify_sms_failed) .setContentTitle(context.getString(R.string.notify_failed) + " " + specs.getErrorMessage()) .setContentText(to + ": " + command.getText()).setTicker(context.getString(R.string.notify_failed_)) .setWhen(System.currentTimeMillis()).setContentIntent(cIntent).setAutoCancel(true) .setLights(NOTIFICATION_LED_COLOR, NOTIFICATION_LED_ON, NOTIFICATION_LED_OFF); final String s = p.getString(WebSMS.PREFS_FAIL_SOUND, null); if (!TextUtils.isEmpty(s)) { b.setSound(Uri.parse(s)); } if (p.getBoolean(WebSMS.PREFS_FAIL_VIBRATE, false)) { b.setVibrate(VIBRATE_ON_FAIL_PATTERN); } NotificationManager mNotificationMgr = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); mNotificationMgr.notify(getNotificationID(), b.build()); // show a toast as well final String em = specs.getErrorMessage(); if (em != null) { Toast.makeText(context, em, Toast.LENGTH_LONG).show(); } }
From source file:id.satusatudua.sigap.ui.fragment.TrustedsFragment.java
@Override public void onNotFoundUser(String email) { AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).setIcon(R.mipmap.ic_launcher) .setTitle("Email Tidak Terdaftar") .setMessage("Email yang anda masukan tidak terdaftar, undang teman anda untuk bergabung ke Sigap?") .setPositiveButton("YA, Undang Dia", (dialog, which) -> { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:" + email)); intent.putExtra(Intent.EXTRA_SUBJECT, "Saya Mengundang Anda Bergabung Ke Sigap"); intent.putExtra(Intent.EXTRA_TEXT, "Halo...!\nSaya membutuhkan anda untuk menjadi kontak yang saya percayai di Sigap, mari bergabung bersama saya di Sigap untuk mewujudkan kehidupan yang lebih Siap dan Tanggap terhadap segala ancaman bahaya. Untuk bergabung ke Sigap silahkan download aplikasinya di url ini [URL].\nTerimakasih banyak atas perhatiannya.\n\nSalam,\n" + CacheManager.pluck().getCurrentUser().getName()); startActivity(intent);//w ww .ja v a 2 s .c o m }).setNegativeButton("TIDAK", (dialog, which1) -> { dialog.dismiss(); }).show(); alertDialog.getButton(DialogInterface.BUTTON_POSITIVE) .setTextColor(ContextCompat.getColor(getActivity(), R.color.colorPrimary)); alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE) .setTextColor(ContextCompat.getColor(getActivity(), R.color.primary_text)); alertDialog.show(); }
From source file:net.vivekiyer.GAL.CorporateContactRecordFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { final AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); // Get the selected item from the listview adapter final KeyValuePair kvp = m_adapter.getItem(info.position); switch (item.getItemId()) { case MENU_ID_CALL: Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" //$NON-NLS-1$ + kvp.getValue()));//from ww w . j a v a 2s. co m startActivity(intent); break; case MENU_ID_SMS: intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:" //$NON-NLS-1$ + kvp.getValue())); startActivity(intent); break; case MENU_ID_COPY_TO_CLIPBOARD: final ClipboardManager clipboard = (ClipboardManager) getActivity() .getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setText(kvp.getValue()); Toast.makeText(this.getActivity(), getString(R.string.text_copied_to_clipboard), Toast.LENGTH_SHORT) .show(); break; case MENU_ID_EDIT_BEFORE_CALL: intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" //$NON-NLS-1$ + kvp.getValue())); startActivity(intent); break; case MENU_ID_EMAIL: intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); //$NON-NLS-1$ intent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { kvp.getValue() }); startActivity(Intent.createChooser(intent, getString(R.string.send_mail))); break; default: return super.onContextItemSelected(item); } return true; }
From source file:com.example.ishita.administrativeapp.AttendantActivity.java
@SuppressWarnings("StatementWithEmptyBody") @Override//from w w w . j a va2 s .co m public boolean onNavigationItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.profile) { /* Intent launch_profile= new Intent(getApplicationContext(),Profile.class); launch_profile.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); launch_profile.putExtra("EXIT",true); startActivity(launch_profile);*/ } else if (id == R.id.about) { /* AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(String.format("%1$s", getString(R.string.app_name))); builder.setMessage(getResources().getText(R.string.about_text)); builder.setPositiveButton("OK", null); builder.setIcon(R.mipmap.ic_launcher); AlertDialog welcomeAlert = builder.create(); welcomeAlert.show(); ((TextView) welcomeAlert.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());*/ } else if (id == R.id.contributors) { /* AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(String.format("%1$s", getString(R.string.contributors))); builder.setMessage(getResources().getText(R.string.contributors_text)); builder.setPositiveButton("OK", null); //builder.setIcon(R.mipmap.nimbus_icon); AlertDialog welcomeAlert = builder.create(); welcomeAlert.show(); ((TextView) welcomeAlert.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());*/ } else if (id == R.id.bug) { Intent intent = new Intent(Intent.ACTION_SENDTO); String uriText = "mailto:" + Uri.encode("ishitathakur@gmail.com") + "?subject=" + Uri.encode("Reporting A Bug/Feedback") + "&body=" + Uri.encode( "Hello, Ishita \nI want to report a bug/give feedback corresponding to the app EOutPass.\n.....\n\n-Your name"); Uri uri = Uri.parse(uriText); intent.setData(uri); startActivity(Intent.createChooser(intent, "Send Email")); } else if (id == R.id.licenses) { /* AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(String.format("%1$s", getString(R.string.open_source_licenses))); builder.setMessage(getResources().getText(R.string.licenses_text)); builder.setPositiveButton("OK", null); //builder.setIcon(R.mipmap.nimbus_icon); AlertDialog welcomeAlert = builder.create(); welcomeAlert.show(); ((TextView) welcomeAlert.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());*/ } return true; }
From source file:texus.autozoneuaenew.fragments.FragmentProductDetails.java
public void sendMail() { Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "cars@autozoneuae.com", null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Enquire about " + product.product_name); emailIntent.putExtra(Intent.EXTRA_TEXT, ""); getActivity().startActivity(Intent.createChooser(emailIntent, "Send email to AutozoneUAE")); }
From source file:co.tinode.tindroid.ContactsFragment.java
private void handleItemClick(final ContactsAdapter.ViewHolder tag) { boolean done = false; if (mPhEmImData != null) { Utils.ContactHolder holder = mPhEmImData.get(tag.contact_id); if (holder != null) { String address = holder.getIm(); if (address != null) { Intent it = new Intent(getActivity(), MessageActivity.class); it.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP); it.putExtra("topic", address); startActivity(it);/*from w w w .j a v a2 s.co m*/ done = true; } if (!done && ((address = holder.getPhone()) != null)) { // Send an SMS with an invitation Uri uri = Uri.fromParts("smsto", address, null); Intent it = new Intent(Intent.ACTION_SENDTO, uri); it.putExtra("sms_body", getString(R.string.tinode_invite_body)); startActivity(it); done = true; } if (!done && ((address = holder.getEmail()) != null)) { Uri uri = Uri.fromParts("mailto", address, null); Intent it = new Intent(Intent.ACTION_SENDTO, uri); it.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.tinode_invite_subject)); it.putExtra(Intent.EXTRA_TEXT, getString(R.string.tinode_invite_body)); startActivity(it); done = true; } } } if (!done) { Toast.makeText(getContext(), R.string.failed_to_invite, Toast.LENGTH_SHORT).show(); } }
From source file:ru.dublgis.androidhelpers.DesktopUtils.java
public static boolean sendEmail(final Context ctx, final String to, final String subject, final String body, final String[] attachment, final String authorities) { try {//from w w w. jav a 2 s . c om final String[] recipients = new String[] { to }; final Intent intent = new Intent( attachment.length > 1 ? Intent.ACTION_SEND_MULTIPLE : Intent.ACTION_SENDTO); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, recipients); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, body); boolean grant_permissions_workaround = false; final ArrayList<Uri> uri = new ArrayList<>(); if (attachment.length > 0) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { for (final String fileName : attachment) { uri.add(Uri.fromFile(new File(fileName))); } } else { // Android 6+: going the longer route. // For more information, please see: // http://stackoverflow.com/questions/32981194/android-6-cannot-share-files-anymore intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); grant_permissions_workaround = true; for (final String fileName : attachment) { uri.add(FileProvider.getUriForFile(ctx, authorities, new File(fileName))); } } // Should not put array with only one element into intent because of a bug in GMail. if (uri.size() == 1) { intent.putExtra(Intent.EXTRA_STREAM, uri.get(0)); } else { intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uri); } } final IntentResolverInfo mailtoIntentResolvers = new IntentResolverInfo(ctx.getPackageManager()); mailtoIntentResolvers .appendResolvers(new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", to, null))); final Intent chooserIntent; if (mailtoIntentResolvers.isEmpty()) { chooserIntent = Intent.createChooser(intent, null); } else { final IntentResolverInfo messageIntentResolvers = new IntentResolverInfo(ctx.getPackageManager()); messageIntentResolvers .appendResolvers(new Intent(Intent.ACTION_SENDTO, Uri.fromParts("sms", "", null))); messageIntentResolvers .appendResolvers(new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mms", "", null))); messageIntentResolvers .appendResolvers(new Intent(Intent.ACTION_SENDTO, Uri.fromParts("tel", "", null))); mailtoIntentResolvers.removeSamePackages(messageIntentResolvers.getResolveInfos()); final List<Intent> intentList = new ArrayList<>(); for (final ActivityInfo activityInfo : mailtoIntentResolvers.getResolveInfos()) { final String packageName = activityInfo.getPackageName(); final String name = activityInfo.getName(); // Some mail clients will not read the URI unless this is done. // See here: https://stackoverflow.com/questions/24467696/android-file-provider-permission-denial if (grant_permissions_workaround) { for (int i = 0; i < uri.size(); ++i) { try { ctx.grantUriPermission(packageName, uri.get(i), Intent.FLAG_GRANT_READ_URI_PERMISSION); } catch (final Throwable e) { Log.e(TAG, "grantUriPermission error: ", e); } } } final Intent cloneIntent = (Intent) intent.clone(); cloneIntent.setComponent(new ComponentName(packageName, name)); intentList.add(cloneIntent); } final Intent targetIntent = intentList.get(0); intentList.remove(0); chooserIntent = Intent.createChooser(targetIntent, null); if (!intentList.isEmpty()) { final Intent[] extraIntents = intentList.toArray(new Intent[intentList.size()]); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, extraIntents); } else { chooserIntent.putExtra(Intent.EXTRA_ALTERNATE_INTENTS, extraIntents); } } } chooserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); ctx.startActivity(chooserIntent); return true; } catch (final Throwable exception) { Log.e(TAG, "sendEmail exception: ", exception); return false; } }
From source file:fr.tvbarthel.apps.simpleweatherforcast.MainActivity.java
private boolean handleActionContactUs() { final String uriString = getString(R.string.contact_us_uri, Uri.encode(getString(R.string.contact_us_email)), Uri.encode(getString(R.string.contact_us_default_subject))); final Uri mailToUri = Uri.parse(uriString); Intent sendToIntent = new Intent(Intent.ACTION_SENDTO); sendToIntent.setData(mailToUri);//from w w w . j a v a 2 s . c o m startActivity(sendToIntent); return true; }
From source file:com.shafiq.myfeedle.core.StatusDialog.java
private void showDialog() { if (mService == SMS) { // if mRect go straight to message app... if (mRect != null) QuickContact.showQuickContact(this, mRect, Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, mEsid), QuickContact.MODE_LARGE, null); else {/*from w w w. j a v a2 s .c om*/ startActivity(new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:" + mEsid))); finish(); } } else if (mService == RSS) { if (mEsid != null) { startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse(mEsid))); finish(); } else { (Toast.makeText(StatusDialog.this, "RSS item has no link", Toast.LENGTH_LONG)).show(); finish(); } } else if (items != null) { // offer options for Comment, Post, Settings and Refresh // loading the likes/retweet and other options takes too long, so load them in the MyfeedleCreatePost.class mDialog = (new AlertDialog.Builder(this)).setItems(items, this).setCancelable(true) .setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { finish(); } }).create(); mDialog.show(); } else { if (mAppWidgetId != Myfeedle.INVALID_ACCOUNT_ID) { // informational messages go to settings mFinish = true; startActivity(Myfeedle.getPackageIntent(this, ManageAccounts.class) .putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId)); finish(); } else { (Toast.makeText(StatusDialog.this, R.string.widget_loading, Toast.LENGTH_LONG)).show(); // force widgets rebuild startService(Myfeedle.getPackageIntent(this, MyfeedleService.class).setAction(ACTION_REFRESH)); finish(); } } }