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.mmga.litedo.activity.SettingsActivity.java
private void sendEmail() { Uri uri = Uri.parse("mailto:1034752946@qq.com"); String[] email = { "1034752946@qq.com" }; Intent intent = new Intent(Intent.ACTION_SENDTO, uri); intent.putExtra(Intent.EXTRA_CC, email); // ? intent.putExtra(Intent.EXTRA_SUBJECT, ""); // intent.putExtra(Intent.EXTRA_TEXT, ""); // startActivity(Intent.createChooser(intent, "")); }
From source file:com.bordengrammar.bordengrammarapp.ParentsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_parents, container, false); mail = (LinearLayout) root.findViewById(R.id.linmail); call = (LinearLayout) root.findViewById(R.id.lincall); call.setOnClickListener(new View.OnClickListener() { @Override//from w w w. j a va2 s . c om public void onClick(View arg0) { Intent cally = new Intent(Intent.ACTION_CALL); cally.setData(Uri.parse("tel:01795424192")); startActivity(cally); } }); mail.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { AlertDialog.Builder alert = new AlertDialog.Builder(getActivity()); alert.setTitle("Send a email to Borden Grammar"); alert.setMessage("Message: "); final EditText input = new EditText(getActivity()); alert.setView(input); alert.setPositiveButton("Send", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String value = input.getText().toString(); // Do something with value! Intent email = new Intent(Intent.ACTION_SEND); email.setType("plain/text"); email.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "school@bordengrammar.kent.sch.uk" }); email.putExtra(Intent.EXTRA_SUBJECT, "Email (Sent From BGS APP) "); email.putExtra(Intent.EXTRA_TEXT, value); startActivity(Intent.createChooser(email, "Choose an Email client :")); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Canceled. } }); alert.show(); } }); URL url = null; try { url = new URL( "http://website.bordengrammar.kent.sch.uk/index.php?option=com_rubberdoc&view=category&id=63%3Aletters&Itemid=241&format=feed&type=rss"); } catch (MalformedURLException e) { e.printStackTrace(); } Feed feed = null; try { feed = FeedParser.parse(url); } catch (FeedIOException e) { e.printStackTrace(); } catch (FeedXMLParseException e) { e.printStackTrace(); } catch (UnsupportedFeedException e) { e.printStackTrace(); } Boolean nully = false; for (int i = 0; i < 3; i++) { try { FeedItem item = feed.getItem(i); } catch (NullPointerException e) { e.printStackTrace(); nully = true; Toast.makeText(getActivity().getApplicationContext(), "Some features of this app require a internet connection", Toast.LENGTH_LONG).show(); } } if (!nully) { final FeedItem post1 = feed.getItem(1); final FeedItem post2 = feed.getItem(2); final FeedItem post3 = feed.getItem(3); TextView title1 = (TextView) root.findViewById(R.id.title1); TextView title2 = (TextView) root.findViewById(R.id.title2); TextView title3 = (TextView) root.findViewById(R.id.title3); title1.setText(post1.getTitle()); title2.setText(post2.getTitle()); title3.setText(post3.getTitle()); TextView link1 = (TextView) root.findViewById(R.id.link1); TextView link2 = (TextView) root.findViewById(R.id.link2); TextView link3 = (TextView) root.findViewById(R.id.link3); link1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String url1 = post1.getLink().toString(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(url1), "text/html"); startActivity(intent); } }); link2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String url1 = post2.getLink().toString(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(url1), "text/html"); startActivity(intent); } }); link3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String url1 = post3.getLink().toString(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(url1), "text/html"); startActivity(intent); } }); } else { TextView title1 = (TextView) root.findViewById(R.id.title1); TextView title2 = (TextView) root.findViewById(R.id.title2); TextView title3 = (TextView) root.findViewById(R.id.title3); title1.setText("No connection"); title2.setText("No connection"); title3.setText("No connection"); } TextView reader = (TextView) root.findViewById(R.id.reader); reader.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String appPackageName = "com.adobe.reader"; // getPackageName() from Context or Activity object try { startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); } catch (android.content.ActivityNotFoundException anfe) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName))); } } }); return root; }
From source file:com.money.manager.ex.about.AboutFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { String text, version;/*from w w w . j av a 2 s . c o m*/ View view = inflater.inflate(R.layout.about_fragment, container, false); MmxBaseFragmentActivity activity = (MmxBaseFragmentActivity) getActivity(); if (activity != null && activity.getSupportActionBar() != null) { activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true); } // Version application TextView txtVersion = (TextView) view.findViewById(R.id.textViewVersion); Core core = new Core(getActivity()); version = core.getAppVersionName(); // build = core.getAppVersionBuild(); txtVersion.setText(getString(R.string.version) + " " + version); // + " (" + getString(R.string.build) + " " + build + ")" // Send Feedback TextView txtFeedback = (TextView) view.findViewById(R.id.textViewLinkFeedback); text = "<u>" + txtFeedback.getText() + "</u>"; txtFeedback.setText(Html.fromHtml(text)); txtFeedback.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { Constants.EMAIL }); intent.putExtra(Intent.EXTRA_SUBJECT, "MoneyManagerEx for Android: Feedback"); try { startActivity(Intent.createChooser(intent, "Send mail...")); } catch (Exception e) { Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show(); } } }); // rate application TextView txtRate = (TextView) view.findViewById(R.id.textViewLinkRate); text = "<u>" + txtRate.getText() + "</u>"; txtRate.setText(Html.fromHtml(text)); txtRate.setMovementMethod(LinkMovementMethod.getInstance()); OnClickListenerUrl clickListenerRate = new OnClickListenerUrl(); clickListenerRate.setUrl("http://play.google.com/store/apps/details?id=com.money.manager.ex"); txtRate.setOnClickListener(clickListenerRate); // application issue tracker TextView txtIssues = (TextView) view.findViewById(R.id.textViewIssuesTracker); text = "<u>" + txtIssues.getText() + "</u>"; txtIssues.setText(Html.fromHtml(text)); txtIssues.setMovementMethod(LinkMovementMethod.getInstance()); OnClickListenerUrl clickListenerIssuesTracker = new OnClickListenerUrl(); clickListenerIssuesTracker.setUrl("https://github.com/moneymanagerex/android-money-manager-ex/issues/"); txtIssues.setOnClickListener(clickListenerIssuesTracker); // MMEX for Android web page TextView txtWebsite = (TextView) view.findViewById(R.id.textViewWebSite); text = "<u>" + txtWebsite.getText() + "</u>"; txtWebsite.setText(Html.fromHtml(text)); txtWebsite.setMovementMethod(LinkMovementMethod.getInstance()); OnClickListenerUrl clickListenerWebsite = new OnClickListenerUrl(); clickListenerWebsite.setUrl("http://android.moneymanagerex.org/"); txtWebsite.setOnClickListener(clickListenerWebsite); // report set link TextView txtReport = (TextView) view.findViewById(R.id.textViewLinkWebSite); text = "<u>" + txtReport.getText() + "</u>"; txtReport.setText(Html.fromHtml(text)); txtReport.setMovementMethod(LinkMovementMethod.getInstance()); OnClickListenerUrl clickListenerFeedback = new OnClickListenerUrl(); clickListenerFeedback .setUrl("http://www.moneymanagerex.org/?utm_campaign=Application_Android&utm_medium=MMEX_" + version + "&utm_source=Website"); txtReport.setOnClickListener(clickListenerFeedback); // image view google plus OnClickListenerUrl clickListenerGooglePlus = new OnClickListenerUrl(); clickListenerGooglePlus.setUrl("http://goo.gl/R693Ih"); ImageView imageViewGooglePlus = (ImageView) view.findViewById(R.id.imageViewGooglePlus); imageViewGooglePlus.setOnClickListener(clickListenerGooglePlus); // image view github OnClickListenerUrl clickListenerGithub = new OnClickListenerUrl(); clickListenerGithub.setUrl("https://github.com/moneymanagerex/android-money-manager-ex"); ImageView imageViewGithub = (ImageView) view.findViewById(R.id.imageViewGithub); imageViewGithub.setOnClickListener(clickListenerGithub); // image view twitter OnClickListenerUrl clickListenerTwitter = new OnClickListenerUrl(); clickListenerTwitter.setUrl("https://twitter.com/MMEX4Android"); ImageView imageViewTwitter = (ImageView) view.findViewById(R.id.imageViewTwitter); imageViewTwitter.setOnClickListener(clickListenerTwitter); // GPLv2 license TextView txtLicense = (TextView) view.findViewById(R.id.textViewLicense); text = "<u>" + txtLicense.getText() + "</u>"; txtLicense.setText(Html.fromHtml(text)); OnClickListenerUrl clickListenerLicense = new OnClickListenerUrl(); clickListenerLicense.setUrl("http://www.gnu.org/licenses/old-licenses/gpl-2.0.html"); txtLicense.setOnClickListener(clickListenerLicense); // logcat TextView txtLogcat = (TextView) view.findViewById(R.id.textViewLogcat); text = "<u>" + txtLogcat.getText() + "</u>"; txtLogcat.setText(Html.fromHtml(text)); txtLogcat.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { LynxConfig lynxConfig = new LynxConfig(); lynxConfig.setMaxNumberOfTracesToShow(4000); Intent lynxActivityIntent = LynxActivity.getIntent(getActivity(), lynxConfig); startActivity(lynxActivityIntent); } }); // Donate, button Button buttonDonate = (Button) view.findViewById(R.id.buttonDonateInApp); buttonDonate.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(getActivity(), DonateActivity.class)); } }); // Send logcat button Button sendLogcatButton = (Button) view.findViewById(R.id.sendLogcatButton); sendLogcatButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { sendLogcat(); } }); return view; }
From source file:ca.rmen.android.networkmonitor.app.about.AboutActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; case R.id.action_send_logs: new AsyncTask<Void, Void, Boolean>() { @Override/*www .j a va 2 s. c o m*/ protected Boolean doInBackground(Void... params) { if (!Log.prepareLogFile()) { return false; } // Bring up the chooser to share the file. Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); //sendIntent.setData(Uri.fromParts("mailto", getString(R.string.send_logs_to), null)); sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.support_send_debug_logs_subject)); String messageBody = getString(R.string.support_send_debug_logs_body); File f = new File(getExternalFilesDir(null), Log.FILE); sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + f.getAbsolutePath())); sendIntent.setType("message/rfc822"); sendIntent.putExtra(Intent.EXTRA_TEXT, messageBody); sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { getString(R.string.support_send_debug_logs_to) }); startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.action_share))); return true; } @Override protected void onPostExecute(Boolean result) { if (!result) Toast.makeText(AboutActivity.this, R.string.support_error, Toast.LENGTH_LONG).show(); } }.execute(); return true; } return super.onOptionsItemSelected(item); }
From source file:at.wada811.utils.IntentUtils.java
/** * ??Intent??/* w w w. ja v a 2 s. co m*/ * * @param mailto * @param cc * @param bcc * @param subject * @param body */ public static Intent createSendMailIntent(String[] mailto, String[] cc, String[] bcc, String subject, String body) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType(HTTP.PLAIN_TEXT_TYPE); intent.putExtra(Intent.EXTRA_EMAIL, mailto); intent.putExtra(Intent.EXTRA_CC, cc); intent.putExtra(Intent.EXTRA_BCC, bcc); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, body); return intent; }
From source file:com.dm.material.dashboard.candybar.helpers.ReportBugsHelper.java
public static void checkForBugs(@NonNull Context context) { new AsyncTask<Void, Void, Boolean>() { MaterialDialog dialog;// w w w . j a v a 2 s .c o m StringBuilder sb; File folder; String file; @Override protected void onPreExecute() { super.onPreExecute(); sb = new StringBuilder(); folder = FileHelper.getCacheDirectory(context); file = folder.toString() + "/" + "reportbugs.zip"; MaterialDialog.Builder builder = new MaterialDialog.Builder(context); builder.content(R.string.report_bugs_building).progress(true, 0).progressIndeterminateStyle(true); dialog = builder.build(); dialog.show(); } @Override protected Boolean doInBackground(Void... voids) { while (!isCancelled()) { try { Thread.sleep(1); SparseArrayCompat<String> files = new SparseArrayCompat<>(); sb.append(DeviceHelper.getDeviceInfo(context)); String brokenAppFilter = buildBrokenAppFilter(context, folder); if (brokenAppFilter != null) files.append(files.size(), brokenAppFilter); String activityList = buildActivityList(context, folder); if (activityList != null) files.append(files.size(), activityList); String stackTrace = Preferences.getPreferences(context).getLatestCrashLog(); String crashLog = buildCrashLog(context, folder, stackTrace); if (crashLog != null) files.append(files.size(), crashLog); FileHelper.createZip(files, file); return true; } catch (Exception e) { Log.d(Tag.LOG_TAG, Log.getStackTraceString(e)); return false; } } return false; } @Override protected void onPostExecute(Boolean aBoolean) { super.onPostExecute(aBoolean); dialog.dismiss(); if (aBoolean) { File zip = new File(file); final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { context.getResources().getString(R.string.dev_email) }); intent.putExtra(Intent.EXTRA_SUBJECT, "Report Bugs " + (context.getString(R.string.app_name))); intent.putExtra(Intent.EXTRA_TEXT, sb.toString()); Uri uri = FileHelper.getUriFromFile(context, context.getPackageName(), zip); intent.putExtra(Intent.EXTRA_STREAM, uri); context.startActivity( Intent.createChooser(intent, context.getResources().getString(R.string.email_client))); } else { Toast.makeText(context, R.string.report_bugs_failed, Toast.LENGTH_LONG).show(); } dialog = null; sb.setLength(0); } }.execute(); }
From source file:net.networksaremadeofstring.rhybudd.ViewZenossEvent.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { finish();/*from w w w. j a v a 2 s .c om*/ return true; } case R.id.AddLog: { addMessageDialog = new Dialog(ViewZenossEvent.this); addMessageDialog.setContentView(R.layout.add_message); addMessageDialog.setTitle("Add Message to Event Log"); ((Button) addMessageDialog.findViewById(R.id.SaveButton)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { AddLogMessage(((EditText) addMessageDialog.findViewById(R.id.LogMessage)).getText().toString()); addMessageDialog.dismiss(); } }); addMessageDialog.show(); return true; } case R.id.escalate: { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); // Add data to the intent, the receiving app will decide what to do with it. intent.putExtra(Intent.EXTRA_SUBJECT, "Escalation of Zenoss Event on " + getIntent().getStringExtra("Device")); String EventDetails = getIntent().getStringExtra("Summary") + "\r\r\n" + getIntent().getStringExtra("LastTime") + "\r\r\n" + "Count: " + getIntent().getIntExtra("Count", 0); intent.putExtra(Intent.EXTRA_TEXT, EventDetails); startActivity(Intent.createChooser(intent, "How would you like to escalate this event?")); } default: { return false; } } }
From source file:de.grobox.blitzmail.SendActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // before doing anything show notification about sending process mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mBuilder = new NotificationCompat.Builder(this); mBuilder.setContentTitle(getString(R.string.sending_mail)).setContentText(getString(R.string.please_wait)) .setSmallIcon(R.drawable.notification_icon).setOngoing(true); // Sets an activity indicator for an operation of indeterminate length mBuilder.setProgress(0, 0, true);/*from w w w. j a v a2 s . c o m*/ // Create Pending Intent notifyIntent = new Intent(this, NotificationHandlerActivity.class); notifyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notifyIntent, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(pendingIntent); // Issues the notification mNotifyManager.notify(0, mBuilder.build()); Properties prefs; try { prefs = getPrefs(); } catch (Exception e) { String msg = e.getMessage(); Log.i("SendActivity", "ERROR: " + msg, e); if (e.getClass().getCanonicalName().equals("java.lang.RuntimeException") && e.getCause() != null && e.getCause().getClass().getCanonicalName().equals("javax.crypto.BadPaddingException")) { msg = getString(R.string.error_decrypt); } showError(msg); return; } // get and handle Intent Intent intent = getIntent(); String action = intent.getAction(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (action.equals(Intent.ACTION_SEND)) { String text = intent.getStringExtra(Intent.EXTRA_TEXT); //String email = intent.getStringExtra(Intent.EXTRA_EMAIL); String subject = intent.getStringExtra(Intent.EXTRA_SUBJECT); String cc = intent.getStringExtra(Intent.EXTRA_CC); String bcc = intent.getStringExtra(Intent.EXTRA_BCC); // Check for empty content if (subject == null && text != null) { // cut all characters from subject after the 128th subject = text.substring(0, (text.length() < 128) ? text.length() : 128); // remove line breaks from subject subject = subject.replace("\n", " ").replace("\r", " "); } else if (subject != null && text == null) { text = subject; } else if (subject == null && text == null) { Log.e("Instant Mail", "Did not send mail, because subject and body empty."); showError(getString(R.string.error_no_body_no_subject)); return; } // create JSON object with mail information mMail = new JSONObject(); try { mMail.put("id", String.valueOf(new Date().getTime())); mMail.put("body", text); mMail.put("subject", subject); mMail.put("cc", cc); mMail.put("bcc", bcc); } catch (JSONException e) { e.printStackTrace(); } // remember mail for later MailStorage.saveMail(this, mMail); // pass mail on to notification dialog class notifyIntent.putExtra("mail", mMail.toString()); // Start Mail Task AsyncMailTask mail = new AsyncMailTask(this, prefs, mMail); mail.execute(); } else if (action.equals("BlitzMailReSend")) { try { mMail = new JSONObject(intent.getStringExtra("mail")); } catch (JSONException e) { e.printStackTrace(); } // pass mail on to notification dialog class notifyIntent.putExtra("mail", mMail.toString()); // Start Mail Task AsyncMailTask mail = new AsyncMailTask(this, prefs, mMail); mail.execute(); } finish(); }
From source file:com.example.venkatagovardhan.docorganizer.AboutActivity.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.btnFeedback: try {//from w w w . j a v a 2s .c om Intent emailIntent = new Intent(Intent.ACTION_SENDTO); emailIntent.setData(Uri.parse("mailto:" + FEEDBACK_ADDRESS)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name) + " feedback"); startActivity(emailIntent); } catch (Exception e) { e.printStackTrace(); } break; case R.id.btnPlaystore: try { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(PLAYSTORE_URL)); startActivity(intent); } catch (Exception e) { e.printStackTrace(); } break; } }
From source file:com.example.nitish.welcomapp.activitypt.AboutFragment.java
/** * Open an email client to send a support request. *//*from w ww .j a v a2 s .co m*/ private void openEmail() { final Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { getString(R.string.aboutEmail) }); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.aboutEmailSubject, BuildConfig.VERSION_NAME)); if (intent.resolveActivity(getContext().getPackageManager()) != null) { startActivity(Intent.createChooser(intent, getString(R.string.aboutSendEmail))); } else { Toast.makeText(getContext(), R.string.errorNoEmail, Toast.LENGTH_LONG).show(); } }