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:com.opencabinetlabs.destinycommunityhub.ui.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (mDrawerToggle.onOptionsItemSelected(item)) { return true; }// w ww . j av a2 s. c om switch (item.getItemId()) { case R.id.action_licenses: new LicenseDialog().show(getSupportFragmentManager(), DIALOG_LICENSE); return true; case R.id.action_feedback: Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "destinycommunityhub1@gmail.com", null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.feedback_subject)); startActivity(Intent.createChooser(emailIntent, "Send feedback...")); return true; } return super.onOptionsItemSelected(item); }
From source file:com.example.android.recyclingbanks.MainActivity.java
/** * composes an email, strictly for email apps. This version takes no attachments *//* ww w . jav a 2 s . c om*/ public void composeEmail(String[] addresses, String subject) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:")); // only email apps should handle this intent.putExtra(Intent.EXTRA_EMAIL, "sam.stratford@gmail.com");//addresses); intent.putExtra(Intent.EXTRA_SUBJECT, subject); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } }
From source file:com.google.zxing.client.android.result.ResultHandler.java
final void sendMMSFromUri(String uri, String subject, String body) { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(uri)); // The Messaging app needs to see a valid subject or else it will treat this an an SMS. if (subject == null || subject.length() == 0) { putExtra(intent, "subject", activity.getString(R.string.msg_default_mms_subject)); } else {//from www .j a va2 s . c o m putExtra(intent, "subject", subject); } putExtra(intent, "sms_body", body); intent.putExtra("compose_mode", true); launchIntent(intent); }
From source file:com.android.messaging.ui.UIIntentsImpl.java
@Override public PendingIntent getPendingIntentForSendingMessageToConversation(final Context context, final String conversationId, final String selfId, final boolean requiresMms, final int requestCode) { final Intent intent = new Intent(context, RemoteInputEntrypointActivity.class); intent.setAction(Intent.ACTION_SENDTO); // Ensure that the platform doesn't reuse PendingIntents across conversations intent.setData(MessagingContentProvider.buildConversationMetadataUri(conversationId)); intent.putExtra(UIIntents.UI_INTENT_EXTRA_CONVERSATION_ID, conversationId); intent.putExtra(UIIntents.UI_INTENT_EXTRA_SELF_ID, selfId); intent.putExtra(UIIntents.UI_INTENT_EXTRA_REQUIRES_MMS, requiresMms); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); return getPendingIntentWithParentStack(context, intent, requestCode); }
From source file:com.example.android.pharmacyinventory.EditorActivity.java
@Override public void onLoadFinished(Loader<Cursor> loader, final Cursor cursor) { // Bail early if the cursor is null or there is less than 1 row in the cursor if (cursor == null || cursor.getCount() < 1) { return;/*from ww w . j av a2 s. co m*/ } // Proceed with moving to the first row of the cursor and reading data from it // (This should be the only row in the cursor) if (cursor.moveToFirst()) { // Find the columns of drug attributes that we're interested in int nameColumnIndex = cursor.getColumnIndex(DrugContract.DrugEntry.COLUMN_DRUG_NAME); int quantityColumnIndex = cursor.getColumnIndex(DrugContract.DrugEntry.COLUMN_DRUG_QUANTITY); int priceColumnIndex = cursor.getColumnIndex(DrugContract.DrugEntry.COLUMN_DRUG_PRICE); int imageColumnIndex = cursor.getColumnIndex(DrugContract.DrugEntry.COLUMN_DRUG_IMAGE); // Extract out the value from the Cursor for the given column index String name = cursor.getString(nameColumnIndex); int quantity = cursor.getInt(quantityColumnIndex); Double price = cursor.getDouble(priceColumnIndex); String picture = cursor.getString(imageColumnIndex); // Update the views on the screen with the values from the database mNameEditText.setText(name); mQuantityText.setText(Integer.toString(quantity)); mPriceEditText.setText(Double.toString(price)); mDrugImage.setImageURI(Uri.parse(picture)); } orderButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Get the Uri for the current drug int IdColumnIndex = cursor.getColumnIndex(DrugContract.DrugEntry._ID); final long itemId = cursor.getLong(IdColumnIndex); Uri mCurrentDrugUri = ContentUris.withAppendedId(DrugContract.DrugEntry.CONTENT_URI, itemId); // Find the columns of drug attributes that we're interested in int nameColumnIndex = cursor.getColumnIndex(DrugContract.DrugEntry.COLUMN_DRUG_NAME); // Read the Drug attributes from the Cursor for the current drug String name = cursor.getString(nameColumnIndex); // Read the drug name to use in subject line String subjectLine = "Need to order: " + name; Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:")); // only email apps should handle this intent.putExtra(Intent.EXTRA_EMAIL, "orders@gmail.com"); intent.putExtra(Intent.EXTRA_SUBJECT, subjectLine); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } } }); }
From source file:com.nxp.nfc_demo.activities.MainActivity.java
public void sendFeedback() { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, this.getString(R.string.email_titel_feedback)); intent.putExtra(Intent.EXTRA_TEXT,/*from w ww .j a v a 2 s . co m*/ "Android Version: " + android.os.Build.VERSION.RELEASE + "\nManufacurer: " + android.os.Build.MANUFACTURER + "\nModel: " + android.os.Build.MODEL + "\nBrand: " + android.os.Build.BRAND + "\nDisplay: " + android.os.Build.DISPLAY + "\nProduct: " + android.os.Build.PRODUCT + "\nIncremental: " + android.os.Build.VERSION.INCREMENTAL); intent.setData(Uri.parse(this.getString(R.string.support_email))); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); this.startActivity(intent); }
From source file:com.shareyourproxy.IntentLauncher.java
/** * Send SMS to phone number.//from w w w. j a v a2s . c o m * * @param activity context * @param phoneNumber to sms */ public static void launchSMSIntent(Activity activity, String phoneNumber) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("smsto:" + phoneNumber)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (intent.resolveActivity(activity.getPackageManager()) != null) { activity.startActivity(intent); } }
From source file:org.medcada.android.activity.MainActivity.java
public void openSupportDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getResources().getString(R.string.menu_support_title)); builder.setItems(getResources().getStringArray(R.array.menu_support_options), new DialogInterface.OnClickListener() { @Override// w ww .j av a2 s. co m public void onClick(DialogInterface dialog, int which) { if (which == 0) { // Email Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:support@assistbud.com")); boolean activityExists = emailIntent.resolveActivityInfo(getPackageManager(), 0) != null; if (activityExists) { startActivity(emailIntent); } else { showSnackBar(getResources().getString(R.string.menu_support_error1), Snackbar.LENGTH_LONG); } } else { // Forum String url = "http://community.glucosio.org/"; Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.setPackage("com.android.chrome"); try { startActivity(i); } catch (ActivityNotFoundException e) { // Chrome is probably not installed // Try with the default browser i.setPackage(null); startActivity(i); } } } }); builder.show(); }
From source file:mobisocial.musubi.ui.fragments.SettingsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); View v = inflater.inflate(R.layout.settings, container, false); // save references to the UI elements that show visible state globalTVMode_ = (CheckedTextView) v.findViewById(R.id.global_tv_mode); wifiFingerprinting_ = (CheckedTextView) v.findViewById(R.id.wifi_fingerprinting_mode); shareApps_ = (CheckedTextView) v.findViewById(R.id.share_apps); shareContactInfo_ = (CheckedTextView) v.findViewById(R.id.share_contact); vacuumDatabase_ = (TextView) v.findViewById(R.id.vacuum_database); devMode_ = (Button) v.findViewById(R.id.set_devmode); setRingtone_ = (TextView) v.findViewById(R.id.set_ringtone); vibrating_ = (CheckedTextView) v.findViewById(R.id.vibrating); anonStats_ = (CheckedTextView) v.findViewById(R.id.report_stats); // connect the global tv mode toggle to the shared preferences vibrating_.setOnClickListener(new VibratingListener()); globalTVMode_.setOnClickListener(new GlobalTVModeListener()); wifiFingerprinting_.setOnClickListener(new WifiFingerprintingListener()); shareApps_.setOnClickListener(new ShareAppsListener()); shareContactInfo_.setOnClickListener(new ShareContactListener()); vacuumDatabase_.setOnClickListener(new VacuumDatabaseListener()); anonStats_.setOnClickListener(new AnonStatsListener()); v.findViewById(R.id.settings_item_ringtone).setOnClickListener(new SetRingtoneListener()); // usage stats v.findViewById(R.id.anon_stats_example).setOnClickListener(new OnClickListener() { @Override/*from w w w . ja v a 2s . com*/ public void onClick(View v) { DialogFragment sample = AnonymousStatsSampleDialog.newInstance(); ((InstrumentedActivity) getActivity()).showDialog(sample); } }); // privacy protection v.findViewById(R.id.settings_item_protection).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { DialogFragment sample = PrivacyProtectionDialog.newInstance(); ((InstrumentedActivity) getActivity()).showDialog(sample); } }); // privacy protection v.findViewById(R.id.settings_item_feedback).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse( "mailto:" + IdentitiesManager.PRE_INSTALL_MUSUBI_PRINCIPAL + "?subject=Musubi%20Feedback")); startActivity(intent); } }); // eula/priv pol v.findViewById(R.id.usage_agreements).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { EulaFragment eula_fragment = new EulaFragment(false); ((InstrumentedActivity) getActivity()).showDialog(eula_fragment); } }); // dev mode devMode_.setOnLongClickListener(new DevModeListener()); devMode_.setBackgroundColor(Color.TRANSPARENT); // connect the local handlers that manage the sd card backup v.findViewById(R.id.free_up_space).setOnClickListener(new FreeUpSpaceListener()); v.findViewById(R.id.sdcard_backup).setOnClickListener(new SDCardBackupListener()); v.findViewById(R.id.sdcard_restore).setOnClickListener(new SDCardRestoreListener()); loadValues(); return v; }
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 *//*from ww w . j a v a2 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); }