List of usage examples for android.content Intent ACTION_SEND
String ACTION_SEND
To view the source code for android.content Intent ACTION_SEND.
Click Source Link
From source file:com.brq.wallet.activity.receive.ReceiveCoinsActivity.java
public void shareRequest(View view) { Intent s = new Intent(android.content.Intent.ACTION_SEND); s.setType("text/plain"); if (CurrencyValue.isNullOrZero(_amount)) { s.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.bitcoin_address_title)); s.putExtra(Intent.EXTRA_TEXT, getBitcoinAddress()); startActivity(Intent.createChooser(s, getResources().getString(R.string.share_bitcoin_address))); } else {/*from w ww . ja v a 2 s . com*/ s.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.payment_request)); s.putExtra(Intent.EXTRA_TEXT, getPaymentUri()); startActivity(Intent.createChooser(s, getResources().getString(R.string.share_payment_request))); } }
From source file:com.example.android.naradaonline.DatagramFragment.java
protected final void sendEmail(DatagramRequest data) { if (data.type != DatagramRequestType.SEND_EMAIL) { Log.w(TAG, "This datagram is actually of type " + data.type.name()); }//from www. j a v a 2 s. co m Log.i("Send email", ""); String[] TO = { data.mEmailTo }; Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setData(Uri.parse("mailto:")); emailIntent.setType("text/plain"); emailIntent.putExtra(Intent.EXTRA_EMAIL, TO); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Your Datagram"); emailIntent.putExtra(Intent.EXTRA_TEXT, data.mEmailBody); try { startActivity(Intent.createChooser(emailIntent, "Send mail...")); Log.i("Finished sending email...", ""); } catch (android.content.ActivityNotFoundException ex) { // Toast.makeText(MainActivity.this, // "There is no email client installed.", Toast.LENGTH_SHORT).show(); } }
From source file:net.mEmoZz.PopMovies.frags.DetailFragment.java
private Intent createShareForecastIntent() { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, "Check this movie: " + titleEndPoint + " from #Popular_Movies_APP"); return shareIntent; }
From source file:com.polyvi.xface.extension.messaging.XMessagingExt.java
/** * ??Email/*from w w w . j a va2 s . c o m*/ * * @param addr * ? * @param body * ? * @param subject * ? * @return ? */ private void sendEmail(String addr, String body, String subject) { String aEmailList[] = { addr }; Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); emailIntent.setType("text/plain"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body); mContext.startActivity(emailIntent); mCallbackContext.success(); }
From source file:com.bangz.shotrecorder.RecordActivity.java
private void SetShareIntent() { if (mShareActionProvider == null) return;/*from w ww. ja va 2 s . c om*/ if (mSplitManager.getNumbers() > 0) { String strDescription = ""; String strNumber = textNumber.getText().toString(); String strTime = String.format("%.02f", mSplitManager.getTotalElapsedTime() / 1000.0f); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = new Date(); String strDate = df.format(date); String strcontent = String.format(getResources().getString(R.string.share_content), strDescription, strNumber, strTime, strDate); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, strcontent); mShareActionProvider.setShareIntent(intent); } else { mShareActionProvider.setShareIntent(null); } }
From source file:com.polyvi.xface.extension.XMessagingExt.java
/** * ??Email/* w ww . j a va 2 s. c o m*/ * @param addr ? * @param body ? * @param subject ? * @return ? */ private XExtensionResult sendEmail(String addr, String body, String subject) { String aEmailList[] = { addr }; Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); emailIntent.setType("text/plain"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body); getContext().startActivity(emailIntent); return new XExtensionResult(XExtensionResult.Status.OK, ""); }
From source file:ca.mymenuapp.ui.activities.RestaurantActivity.java
private void setShareIntent(RestaurantMenu menu) { Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); // todo check if this item has a picture shareIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_restaurant, menu.getRestaurant().businessName, menu.getRestaurant().businessPicture)); shareIntent.setType("text/plain"); shareActionProvider.setShareIntent(shareIntent); }
From source file:com.becapps.easydownloader.ShareActivity.java
void handleSendText(Intent intent, String action) throws IOException { ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); if (networkInfo != null && networkInfo.isConnected()) { String sharedText = null; if (action.equals(Intent.ACTION_SEND)) { sharedText = intent.getStringExtra(Intent.EXTRA_TEXT); } else if (action.equals(Intent.ACTION_VIEW)) { sharedText = intent.getDataString(); }/*from w w w . jav a2 s . c o m*/ if (sharedText != null) { if (linkValidator(sharedText) == "not_a_valid_video_link") { badOrNullLinkAlert(); } else if (sharedText != null) { showGeneralInfoTutorial(); asyncDownload = new AsyncDownload(); asyncDownload.execute(validatedLink); } } else { badOrNullLinkAlert(); } } else { progressBar1.setVisibility(View.GONE); tv.setText(getString(R.string.no_net)); PopUps.showPopUp(getString(R.string.no_net), getString(R.string.no_net_dialog_msg), "alert", this); Button retry = (Button) findViewById(R.id.share_activity_retry_button); retry.setVisibility(View.VISIBLE); retry.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Utils.reload(ShareActivity.this); } }); } }
From source file:com.jtechme.apphub.FDroidApp.java
public void sendViaBluetooth(Activity activity, int resultCode, String packageName) { if (resultCode == Activity.RESULT_CANCELED) return;/*from w ww.ja va 2 s. c o m*/ String bluetoothPackageName = null; String className = null; boolean found = false; Intent sendBt = null; try { PackageManager pm = getPackageManager(); ApplicationInfo appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); sendBt = new Intent(Intent.ACTION_SEND); // The APK type is blocked by stock Android, so use zip // sendBt.setType("application/vnd.android.package-archive"); sendBt.setType("application/zip"); sendBt.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + appInfo.publicSourceDir)); // not all devices have the same Bluetooth Activities, so // let's find it for (ResolveInfo info : pm.queryIntentActivities(sendBt, 0)) { bluetoothPackageName = info.activityInfo.packageName; if ("com.android.bluetooth".equals(bluetoothPackageName) || "com.mediatek.bluetooth".equals(bluetoothPackageName)) { className = info.activityInfo.name; found = true; break; } } } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "Could not get application info to send via bluetooth", e); found = false; } if (sendBt != null) { if (found) { sendBt.setClassName(bluetoothPackageName, className); activity.startActivity(sendBt); } else { Toast.makeText(this, R.string.bluetooth_activity_not_found, Toast.LENGTH_SHORT).show(); activity.startActivity(Intent.createChooser(sendBt, getString(R.string.choose_bt_send))); } } }
From source file:ca.mudar.parkcatcher.ui.fragments.DetailsFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { final Resources res = getResources(); if (item.getItemId() == R.id.menu_favorites_toggle) { onCheckedChanged(mIsStarred);/*from w w w . ja v a 2 s. com*/ mIsStarred = (mIsStarred ? false : true); // Toggle value getSherlockActivity().invalidateOptionsMenu(); return true; } else if (item.getItemId() == R.id.menu_map) { final Intent intent = new Intent(getActivity(), MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.putExtra(Const.INTENT_EXTRA_GEO_LAT, mGeoLat); intent.putExtra(Const.INTENT_EXTRA_GEO_LNG, mGeoLng); intent.putExtra(Const.INTENT_EXTRA_POST_ID, mIdPost); startActivity(intent); return true; } else if (item.getItemId() == R.id.menu_reminder) { parkingApp.showToastText(R.string.toast_todo_reminder, Toast.LENGTH_LONG); return true; } else if (item.getItemId() == R.id.menu_directions) { if ((Double.compare(mGeoLat, Double.MIN_VALUE) != 0) && (Double.compare(mGeoLng, Double.MIN_VALUE) != 0)) { /** * Get directions using Intents. */ try { final Uri uriNavigation = Uri .parse(String.format(Const.URI_INTENT_NAVIGATION, mGeoLat, mGeoLng)); final Intent intent = new Intent(Intent.ACTION_VIEW, uriNavigation); startActivity(intent); } catch (Exception e) { e.printStackTrace(); String sAddr = ""; Location userLocation = parkingApp.getLocation(); if (userLocation != null) { sAddr = Double.toString(userLocation.getLatitude()) + "," + Double.toString(userLocation.getLongitude()); } final String urlGmaps = String.format(Const.URL_GMAPS_DIRECTIONS, sAddr, mGeoLat + "," + mGeoLng); final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlGmaps)); startActivity(intent); } } return true; } else if (item.getItemId() == R.id.menu_streetview) { if ((Double.compare(mGeoLat, Double.MIN_VALUE) != 0) && (Double.compare(mGeoLng, Double.MIN_VALUE) != 0)) { try { final Uri uriStreetView = Uri .parse(String.format(Const.URI_INTENT_STREETVIEW, mGeoLat, mGeoLng)); final Intent intent = new Intent(Intent.ACTION_VIEW, uriStreetView); startActivity(intent); } catch (NullPointerException e) { e.printStackTrace(); return false; } catch (Exception e) { parkingApp.showToastText(R.string.toast_streetview_error, Toast.LENGTH_LONG); e.printStackTrace(); final Uri uriInstallStreetView = Uri.parse(Const.URI_INSTALL_STREETVIEW); final Intent intent = new Intent(Intent.ACTION_VIEW, uriInstallStreetView); startActivity(intent); return false; } } return true; } else if (item.getItemId() == R.id.menu_share) { final GregorianCalendar parkingCalendar = parkingApp.getParkingCalendar(); final int dayOfWeek = (parkingCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY ? 7 : parkingCalendar.get(Calendar.DAY_OF_WEEK) - 1); final double parkingHour = parkingCalendar.get(Calendar.HOUR_OF_DAY) + Math.round(parkingCalendar.get(Calendar.MINUTE) / 0.6) / 100.00d; // final int duration = parkingApp.getParkingDuration(); final String url = String.format(res.getString(R.string.url_share_post_id), mIdPost, dayOfWeek, parkingHour, parkingApp.getParkingDuration()); final String subject = String.format(res.getString(R.string.details_share_title), url); final String desc = String.format(res.getString(R.string.details_share_subtitle), mShareDesc); final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); // EXTRA_SUBJECT is not used to allow sharing with SMS instead of // MMS // intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, subject + Const.LINE_SEPARATOR + desc); startActivity(intent); return true; } return (activityHelper.onOptionsItemSelected(item) || super.onOptionsItemSelected(item)); }