List of usage examples for android.content Intent EXTRA_SUBJECT
String EXTRA_SUBJECT
To view the source code for android.content Intent EXTRA_SUBJECT.
Click Source Link
From source file:com.microsoft.azure.engagement.fragment.GetDeviceIdFragment.java
/** * Method that shares the device id/*from w w w. ja v a2 s. co m*/ */ private final void shareDeviceID() { if (deviceId != null) { final Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.get_the_device_id_share_object)); intent.putExtra(Intent.EXTRA_TEXT, deviceId); startActivity(intent); Log.d(GetDeviceIdFragment.TAG, "Intent share started"); } else { Log.w(GetDeviceIdFragment.TAG, "Device ID is null"); } AzmeTracker.sendEvent(getActivity(), "share_device_id"); }
From source file:com.pasta.mensadd.fragments.ImprintFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.feedback: Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "julianctni@gmail.com", null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "feedback mensaDD"); startActivity(Intent.createChooser(emailIntent, getString(R.string.send_feedback_mail))); return true; default://from ww w .j ava 2 s. c o m return super.onOptionsItemSelected(item); } }
From source file:com.nexus.nsnik.randomno.view.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int menuItemId = item.getItemId(); switch (menuItemId) { case R.id.menuSettings: startActivityForResult(new Intent(MainActivity.this, PreferenceActivity.class), PREFERENCE_REQUEST_CODE); break;/*from www.j ava2 s.c o m*/ case R.id.menuAbout: new AboutDialogFragment().show(getSupportFragmentManager(), "AboutDialog"); break; case R.id.menuFeedback: Intent sentEmail = new Intent(Intent.ACTION_SENDTO); sentEmail.setData(Uri.parse("mailto:")); sentEmail.putExtra(Intent.EXTRA_EMAIL, getResources().getString(R.string.developerEmailAddress)); sentEmail.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.emailSubject)); if (sentEmail.resolveActivity(getPackageManager()) != null) startActivity(sentEmail); break; } return true; }
From source file:com.jaspervanriet.huntingthatproduct.Activities.WebActivity.java
private Intent getShareIntent() { Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_SUBJECT, mProductTitle); i.putExtra(Intent.EXTRA_TEXT, mProductUrl); return i;// w ww. jav a2s . co m }
From source file:com.emartynov.android.app.urlsetter.android.ui.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.action_about) { startActivity(new Intent(this, AboutActivity.class)); return true; } else if (item.getItemId() == R.id.action_feedback) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "bijdorpstudio@gmail.com", null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.feedback_subject)); startActivity(Intent.createChooser(emailIntent, getString(R.string.action_feedback))); return true; } else if (item.getItemId() == R.id.action_resolve_link) { FragmentManager fm = getSupportFragmentManager(); EnterShortenedUrlFragment userInputDialog = new EnterShortenedUrlFragment(); userInputDialog.show(fm, null);/*from w w w.j a v a 2 s.c o m*/ return true; } else { return super.onOptionsItemSelected(item); } }
From source file:com.nuvolect.securesuite.data.ExportVcf.java
public static void emailVcf(Activity act, long contact_id) { String messageTitle = "vCard for "; String messageBody = "\n\n\nContact from SecureSuite, a secure contact manager"; try {//from w w w. j av a2 s . c o m String displayName = SqlCipher.get(contact_id, ATab.display_name); String fileName = displayName.replaceAll("\\W+", ""); if (fileName.isEmpty()) fileName = "contact"; fileName = fileName + ".vcf"; new File(act.getFilesDir() + CConst.SHARE_FOLDER).mkdirs(); File vcf_file = new File(act.getFilesDir() + CConst.SHARE_FOLDER + fileName); writeContactVcard(contact_id, vcf_file); // Must match "authorities" in Manifest provider definition String authorities = act.getResources().getString(R.string.app_authorities) + ".provider"; Uri uri = null; try { uri = FileProvider.getUriForFile(act, authorities, vcf_file); } catch (IllegalArgumentException e) { LogUtil.logException(act, LogType.EXPORT_VCF, e); } //convert from paths to Android friendly Parcelable Uri's ArrayList<Uri> uris = new ArrayList<Uri>(); uris.add(uri); Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, messageTitle + displayName); intent.putExtra(Intent.EXTRA_TEXT, messageBody); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.putExtra("path", vcf_file.getAbsolutePath()); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); act.startActivityForResult(Intent.createChooser(intent, "Share with..."), CConst.RESPONSE_CODE_SHARE_VCF); } catch (Exception e) { LogUtil.logException(act, LogType.EXPORT_VCF, e); } }
From source file:com.karthikb351.vitinfo2.fragment.AboutFragment.java
void sendFeedBack(View view) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setType(Constants.INTENT_TYPE_PLAIN); intent.setData(Uri.parse(Constants.FEEDBACK_EMAIL_LINK)); intent.putExtra(Intent.EXTRA_SUBJECT, Constants.FEEDBACK_EMAIL_SUBJECT); startActivity(intent);//from w w w. j ava 2 s .c o m }
From source file:at.bitfire.davdroid.ui.DebugInfoActivity.java
public void onShare(MenuItem item) { if (!TextUtils.isEmpty(report)) { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.setType("text/plain"); sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name) + " " + BuildConfig.VERSION_NAME + " debug info"); // since Android 4.1, FileProvider permissions are handled in a useful way (using ClipData) boolean asAttachment = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN; if (asAttachment) try { File debugInfoDir = new File(getCacheDir(), "debug-info"); debugInfoDir.mkdir();//from ww w . j av a 2s . co m reportFile = new File(debugInfoDir, "debug.txt"); App.log.fine("Writing debug info to " + reportFile.getAbsolutePath()); FileWriter writer = new FileWriter(reportFile); writer.write(report); writer.close(); sendIntent.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(this, getString(R.string.authority_log_provider), reportFile)); sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); } catch (IOException e) { // creating an attachment failed, so send it inline asAttachment = false; StringBuilder builder = new StringBuilder(); builder.append("Couldn't write debug info file:\n").append(ExceptionUtils.getStackTrace(e)) .append("\n\n").append(report); report = builder.toString(); } if (!asAttachment) sendIntent.putExtra(Intent.EXTRA_TEXT, report); startActivity(Intent.createChooser(sendIntent, null)); } }
From source file:im.delight.android.baselib.Social.java
/** * Constructs an Intent for sharing/sending a file and starts Activity chooser for that Intent * * @param context Context reference to start the Activity chooser from * @param windowTitle the string to be used as the window title for the Activity chooser * @param file the File instance to be shared * @param mimeType the MIME type for the file to be shared (e.g. image/jpeg) * @param messageTitle the message title/subject that may be provided in addition to the file, if supported by the target app *//* w w w . j a v a2 s . co m*/ public static void shareFile(Context context, String windowTitle, File file, final String mimeType, String messageTitle) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setType(mimeType); intent.putExtra(Intent.EXTRA_SUBJECT, messageTitle); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); context.startActivity(Intent.createChooser(intent, windowTitle)); }
From source file:de.wikilab.android.friendica01.FileUploadService.java
private void showFailMsg(Context ctx, String txt) { NotificationManager mNotificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); Log.e("Andfrnd/UploadFile", "Upload FAILED: " + txt); //Instantiate the Notification: CharSequence tickerText = "Upload failed, please retry!"; Notification notification = new Notification(R.drawable.arrow_up, tickerText, System.currentTimeMillis()); notification.flags |= Notification.FLAG_AUTO_CANCEL; //Define the Notification's expanded message and Intent: Context context = getApplicationContext(); CharSequence contentTitle = "Upload failed, click to retry!"; CharSequence contentText = txt; Intent notificationIntent = new Intent(this, FriendicaImgUploadActivity.class); Bundle b = new Bundle(); b.putParcelable(Intent.EXTRA_STREAM, fileToUpload); b.putString(Intent.EXTRA_SUBJECT, subject); b.putString(EXTRA_DESCTEXT, descText); notificationIntent.putExtras(b);/*from w w w .j a v a 2s . c om*/ PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); //Pass the Notification to the NotificationManager: mNotificationManager.notify(UPLOAD_FAILED_ID, notification); //Toast.makeText(ctx, "Upload failed, please retry:\n" + txt, Toast.LENGTH_LONG).show(); }