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.jjoe64.graphview_demos.fragments.CollectData.java
private void sendTextToEmail() { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + mEmailAddress)); intent.putExtra("subject", "Result of " + getString(R.string.app_name)); intent.putExtra("body", mTvSerial.getText().toString().trim()); startActivity(intent);/*from ww w . j a va2s . co m*/ }
From source file:dynamite.zafroshops.app.MainActivity.java
public void emailUs(View view) { Intent i = new Intent(Intent.ACTION_SENDTO); String uri = "mailto:" + Uri.encode(getString(R.string.zafroshops_email)) + "?subject=" + Uri.encode(getString(R.string.email_subject)) + "&body=" + Uri.encode(getString(R.string.email_content)); i.setData(Uri.parse(uri));//from w ww . j av a 2 s.c o m startActivity(Intent.createChooser(i, getString(R.string.email_us))); }
From source file:org.alfresco.mobile.android.application.fragments.person.PersonProfileFragment.java
public static void actionStartIm(Activity a, String personId) { Uri imUri = new Uri.Builder().scheme("imto").authority("gtalk").appendPath(personId).build(); Intent intent = new Intent(Intent.ACTION_SENDTO, imUri); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try {/*from w w w.j a v a2s . com*/ a.startActivity(intent); } catch (ActivityNotFoundException e) { } }
From source file:org.alfresco.mobile.android.application.fragments.user.UserProfileFragment.java
public static void actionStartIm(FragmentActivity activity, String personId) { Uri imUri = new Uri.Builder().scheme("imto").authority("gtalk").appendPath(personId).build(); Intent intent = new Intent(Intent.ACTION_SENDTO, imUri); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try {//from w ww . j a va 2 s . c o m if (intent.resolveActivity(activity.getPackageManager()) == null) { AlfrescoNotificationManager.getInstance(activity).showAlertCrouton((FragmentActivity) activity, activity.getString(R.string.feature_disable)); return; } activity.startActivity(intent); } catch (ActivityNotFoundException e) { } }
From source file:com.android.gpstest.GpsTestActivity.java
private void sendLocation() { if (mLastLocation != null) { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "", null)); String location = "http://maps.google.com/maps?geocode=&q=" + Double.toString(mLastLocation.getLatitude()) + "," + Double.toString(mLastLocation.getLongitude()); intent.putExtra(Intent.EXTRA_TEXT, location); startActivity(intent);/*from www. j a v a 2s. c o m*/ } }
From source file:org.totschnig.myexpenses.util.Utils.java
public static void share(Context ctx, ArrayList<Uri> fileUris, String target, String mimeType) { URI uri = null;// w ww . j a v a 2s .c o m Intent intent; String scheme = "mailto"; boolean multiple = fileUris.size() > 1; if (!target.equals("")) { uri = Utils.validateUri(target); if (uri == null) { Toast.makeText(ctx, ctx.getString(R.string.ftp_uri_malformed, target), Toast.LENGTH_LONG).show(); return; } scheme = uri.getScheme(); } // if we get a String that does not include a scheme, // we interpret it as a mail address if (scheme == null) { scheme = "mailto"; } if (scheme.equals("ftp")) { if (multiple) { Toast.makeText(ctx, "sending multiple file through ftp is not supported", Toast.LENGTH_LONG).show(); return; } intent = new Intent(android.content.Intent.ACTION_SENDTO); intent.putExtra(Intent.EXTRA_STREAM, fileUris.get(0)); intent.setDataAndType(android.net.Uri.parse(target), mimeType); if (!isIntentAvailable(ctx, intent)) { Toast.makeText(ctx, R.string.no_app_handling_ftp_available, Toast.LENGTH_LONG).show(); return; } ctx.startActivity(intent); } else if (scheme.equals("mailto")) { if (multiple) { intent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE); ArrayList<Uri> uris = new ArrayList<>(); for (Uri fileUri : fileUris) { uris.add(fileUri); } intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); } else { intent = new Intent(android.content.Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_STREAM, fileUris.get(0)); } intent.setType(mimeType); if (uri != null) { String address = uri.getSchemeSpecificPart(); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { address }); } intent.putExtra(Intent.EXTRA_SUBJECT, R.string.export_expenses); if (!isIntentAvailable(ctx, intent)) { Toast.makeText(ctx, R.string.no_app_handling_email_available, Toast.LENGTH_LONG).show(); return; } // if we got mail address, we launch the default application // if we are called without target, we launch the chooser // in order to make action more explicit if (uri != null) { ctx.startActivity(intent); } else { ctx.startActivity(Intent.createChooser(intent, ctx.getString(R.string.share_sending))); } } else { Toast.makeText(ctx, ctx.getString(R.string.share_scheme_not_supported, scheme), Toast.LENGTH_LONG) .show(); return; } }
From source file:com.jjoe64.graphview_demos.fragments.StartSensors.java
private void sendTextToEmail() { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + mEmailAddress)); intent.putExtra("subject", "Result of " + getString(R.string.app_name)); //intent.putExtra("body", mTvSerial.getText().toString().trim()); startActivity(intent);/*w w w .ja v a 2s . c o m*/ }
From source file:tw.net.ezcall.ui.SipHome.java
private void selectTabWithAction(Intent intent) { if (intent != null) { String callAction = intent.getAction(); if (!TextUtils.isEmpty(callAction)) { ActionBar ab = getSupportActionBar(); Tab toSelectTab = null;// w ww . ja va2 s .co m Integer toSelectId = null; if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_DIALER) || callAction.equalsIgnoreCase(Intent.ACTION_DIAL) || callAction.equalsIgnoreCase(Intent.ACTION_VIEW) || callAction.equalsIgnoreCase(Intent.ACTION_SENDTO) /* * TODO * : * sendto * should * im * if * not * csip * ? */) { Integer pos = mTabsAdapter.getPositionForId(TAB_ID_DIALER); if (pos != null) { toSelectTab = ab.getTabAt(pos); Uri data = intent.getData(); String nbr = UriUtils.extractNumberFromIntent(intent, this); if (!TextUtils.isEmpty(nbr)) { if (data != null && mDialpadFragment != null) { mDialpadFragment.setTextDialing(true); mDialpadFragment.setTextFieldValue(nbr); } else { initDialerWithText = nbr; } } toSelectId = TAB_ID_DIALER; } } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_CALLLOG)) { Integer pos = mTabsAdapter.getPositionForId(TAB_ID_CALL_LOG); if (pos != null) { toSelectTab = ab.getTabAt(pos); toSelectId = TAB_ID_CALL_LOG; } } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_FAVORITES)) { Integer pos = mTabsAdapter.getPositionForId(TAB_ID_FAVORITES); if (pos != null) { toSelectTab = ab.getTabAt(pos); toSelectId = TAB_ID_FAVORITES; } } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_MESSAGES)) { Integer pos = mTabsAdapter.getPositionForId(TAB_ID_MESSAGES); if (pos != null) { toSelectTab = ab.getTabAt(pos); toSelectId = TAB_ID_MESSAGES; } } if (toSelectTab != null) { ab.selectTab(toSelectTab); initTabId = toSelectId; } else { initTabId = 0; } } } }
From source file:com.csipsimple.ui.SipHome.java
private void selectTabWithAction(Intent intent) { if (intent != null) { String callAction = intent.getAction(); if (!TextUtils.isEmpty(callAction)) { ActionBar ab = getSupportActionBar(); Tab toSelectTab = null;/* w w w.ja v a2 s .c om*/ Integer toSelectId = null; if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_DIALER) || callAction.equalsIgnoreCase(Intent.ACTION_DIAL) || callAction.equalsIgnoreCase(Intent.ACTION_VIEW) || callAction.equalsIgnoreCase( Intent.ACTION_SENDTO) /* TODO : sendto should im if not csip? */) { Integer pos = mTabsAdapter.getPositionForId(TAB_ID_DIALER); if (pos != null) { toSelectTab = ab.getTabAt(pos); Uri data = intent.getData(); String nbr = UriUtils.extractNumberFromIntent(intent, this); if (!TextUtils.isEmpty(nbr)) { if (data != null && mDialpadFragment != null) { mDialpadFragment.setTextDialing(true); mDialpadFragment.setTextFieldValue(nbr); } else { initDialerWithText = nbr; } } toSelectId = TAB_ID_DIALER; } } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_CALLLOG)) { Integer pos = mTabsAdapter.getPositionForId(TAB_ID_CALL_LOG); if (pos != null) { toSelectTab = ab.getTabAt(pos); toSelectId = TAB_ID_CALL_LOG; } } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_FAVORITES)) { Integer pos = mTabsAdapter.getPositionForId(TAB_ID_FAVORITES); if (pos != null) { toSelectTab = ab.getTabAt(pos); toSelectId = TAB_ID_FAVORITES; } } else if (callAction.equalsIgnoreCase(SipManager.ACTION_SIP_MESSAGES)) { Integer pos = mTabsAdapter.getPositionForId(TAB_ID_MESSAGES); if (pos != null) { toSelectTab = ab.getTabAt(pos); toSelectId = TAB_ID_MESSAGES; } } if (toSelectTab != null) { ab.selectTab(toSelectTab); initTabId = toSelectId; } else { initTabId = 0; } } } }
From source file:jp.ksksue.app.terminal.AndroidUSBSerialMonitorLite.java
private void sendTextToEmail() { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + mEmailAddress)); intent.putExtra("subject", "Result of " + getString(R.string.app_name)); intent.putExtra("body", mTvSerial.getText().toString().trim()); startActivity(intent);//ww w. j a v a 2 s . co m }