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:au.com.wallaceit.reddinator.ViewRedditActivity.java
public void shareText(String txt) { Intent sendintent = new Intent(Intent.ACTION_SEND); sendintent.setAction(Intent.ACTION_SEND); sendintent.putExtra(Intent.EXTRA_TEXT, txt); sendintent.setType("text/plain"); startActivity(Intent.createChooser(sendintent, "Share Url to...")); }
From source file:com.christophergs.mbientbasic.SensorFragment.java
@Override public void onViewCreated(final View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (sensorResId != 2131165359) { chart = (LineChart) view.findViewById(R.id.data_chart); initializeChart();//from ww w. j a v a 2 s .c o m resetData(false); chart.invalidate(); chart.setDescription(null); Button clearButton = (Button) view.findViewById(R.id.layout_two_button_left); clearButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { refreshChart(true); } }); clearButton.setText(R.string.label_clear); } else { Log.i(TAG, "Pie Chart"); } ((Switch) view.findViewById(R.id.sample_control)) .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (b) { moveViewToLast(); setup(); chartHandler.postDelayed(updateChartTask, UPDATE_PERIOD); } else { chart.setVisibleXRangeMaximum(sampleCount); clean(); if (streamRouteManager != null) { streamRouteManager.remove(); streamRouteManager = null; } chartHandler.removeCallbacks(updateChartTask); } } }); Button chartButton = (Button) view.findViewById(R.id.layout_two_button_center); chartButton.setText(R.string.label_pie); Button saveButton = (Button) view.findViewById(R.id.layout_two_button_right); saveButton.setText(R.string.label_save); saveButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String filename = saveData(false); if (filename != null) { File dataFile = getActivity().getFileStreamPath(filename); Uri contentUri = FileProvider.getUriForFile(getActivity(), "com.mbientlab.metawear.app.fileprovider2", dataFile); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, filename); intent.putExtra(Intent.EXTRA_STREAM, contentUri); startActivity(Intent.createChooser(intent, "Saving Data")); } } }); }
From source file:gov.wa.wsdot.android.wsdot.ui.TwitterFragment.java
private Intent createShareIntent(String mText) { 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, mText); return shareIntent; }
From source file:com.richtodd.android.quiltdesign.app.BlockEditActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int itemId = item.getItemId(); switch (itemId) { case android.R.id.home: { NavUtils.navigateUpFromSameTask(this); return true; }/*w w w . ja va2s. c o m*/ case R.id.menu_blockOptions: { PaperPiecedBlock block = getBlockEditFragment().getBlock(); BlockOptionsDialogFragment dialog = BlockOptionsDialogFragment.create((int) block.getWidth()); dialog.show(getFragmentManager(), null); return true; } case R.id.menu_shareBlock: { ShareOptionsDialogFragment dialog = ShareOptionsDialogFragment.create(Intent.ACTION_SEND); dialog.show(getFragmentManager(), null); return true; } case R.id.menu_viewBlock: { ShareOptionsDialogFragment dialog = ShareOptionsDialogFragment.create(Intent.ACTION_VIEW); dialog.show(getFragmentManager(), null); return true; } case R.id.menu_renameBlock: { showEditNameDialog(); return true; } case R.id.menu_deleteBlock: { AlertDialogFragment dialog = AlertDialogFragment.create(KEY_CONFIRM_DELETE, getString(R.string.alert_message_confirmBlockDelete), getString(R.string.alert_button_yes), getString(R.string.alert_button_no)); dialog.show(getFragmentManager(), null); return true; } case R.id.menu_cancelChanges: { getBlockEditFragment().setSaveSuppressed(true); finish(); return true; } case R.id.menu_settings: { Intent intent = new Intent(this, BlockPreferenceActivity.class); startActivity(intent); return true; } } return super.onOptionsItemSelected(item); }
From source file:es.uja.photofirma.android.LoginActivity.java
/** * Accin ejecutada si el usuario pulsa sobre la opcin que indica que no recuerda su contrasea, * abre una instancia de la aplicacin de email del dispositivo para contactar con el administrador * /*from w ww .j av a 2 s .c o m*/ */ public void onForgotPassword(View view) { Intent it = new Intent(Intent.ACTION_SEND); it.putExtra(Intent.EXTRA_EMAIL, new String[] { getString(R.string.developer_email) }); it.putExtra(Intent.EXTRA_SUBJECT, "Olvid mi contrasea..."); it.setType("message/rfc822"); startActivity(Intent.createChooser(it, null)); }
From source file:com.ap.jesus.migsv2.CamActivity.java
protected void saveScreenCaptureToExternalStorage(Bitmap screenCapture) { if (screenCapture != null) { // store screenCapture into external cache directory final File screenCaptureFile = new File(Environment.getExternalStorageDirectory().toString(), "screenCapture_" + System.currentTimeMillis() + ".jpg"); // 1. Save bitmap to file & compress to jpeg. You may use PNG too try {/* w w w. j a v a 2s. co m*/ final FileOutputStream out = new FileOutputStream(screenCaptureFile); screenCapture.compress(Bitmap.CompressFormat.JPEG, 90, out); out.flush(); out.close(); // 2. create send intent final Intent share = new Intent(Intent.ACTION_SEND); share.setType("image/jpg"); share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(screenCaptureFile)); // 3. launch intent-chooser final String chooserTitle = "Share Snaphot"; CamActivity.this.startActivity(Intent.createChooser(share, chooserTitle)); } catch (final Exception e) { // should not occur when all permissions are set CamActivity.this.runOnUiThread(new Runnable() { @Override public void run() { // show toast message in case something went wrong Toast.makeText(CamActivity.this, "Unexpected error, " + e, Toast.LENGTH_LONG).show(); } }); } } }
From source file:ca.rmen.android.poetassistant.PoemAudioExport.java
private PendingIntent getFileShareIntent() { // Bring up the chooser to share the file. Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); Uri uri = FileProvider.getUriForFile(mContext, BuildConfig.APPLICATION_ID + ".fileprovider", getAudioFile());/*from w ww.ja va2 s .c o m*/ sendIntent.putExtra(Intent.EXTRA_STREAM, uri); sendIntent.setType("audio/x-wav"); return PendingIntent.getActivity(mContext, 0, sendIntent, PendingIntent.FLAG_UPDATE_CURRENT); }
From source file:com.architjn.materialicons.ui.fragments.HomeFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == android.R.id.home) { drawer.openDrawer(Gravity.LEFT); }//from w w w . ja va 2s.co m if (id == R.id.action_sendemail) { StringBuilder emailBuilder = new StringBuilder(); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:" + getResources().getString(R.string.email_id))); intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject)); emailBuilder.append("\n \n \nOS Version: ").append(System.getProperty("os.version")).append("(") .append(Build.VERSION.INCREMENTAL).append(")"); emailBuilder.append("\nOS API Level: ").append(Build.VERSION.SDK_INT); emailBuilder.append("\nDevice: ").append(Build.DEVICE); emailBuilder.append("\nManufacturer: ").append(Build.MANUFACTURER); emailBuilder.append("\nModel (and Product): ").append(Build.MODEL).append(" (").append(Build.PRODUCT) .append(")"); PackageInfo appInfo = null; try { appInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } assert appInfo != null; emailBuilder.append("\nApp Version Name: ").append(appInfo.versionName); emailBuilder.append("\nApp Version Code: ").append(appInfo.versionCode); intent.putExtra(Intent.EXTRA_TEXT, emailBuilder.toString()); startActivity(Intent.createChooser(intent, (getResources().getString(R.string.send_title)))); return true; } else if (id == R.id.action_share) { Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); String shareBody = getResources().getString(R.string.share_one) + getResources().getString(R.string.developer_name) + getResources().getString(R.string.share_two) + MARKET_URL + getActivity().getPackageName(); sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody); startActivity(Intent.createChooser(sharingIntent, (getResources().getString(R.string.share_title)))); } else if (id == R.id.action_changelog) { showChangelog(); } return super.onOptionsItemSelected(item); }
From source file:at.wada811.utils.IntentUtils.java
/** * ??Intent??//from w w w . j a v a2 s. c o m */ public static Intent createSendImageIntent(String filePath) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.setType(MediaUtils.getMimeType(filePath)); intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + filePath)); return intent; }