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.cpd.activities.NewsOpenActivity.java
private Intent getDefaultShareIntent() { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name) + " - " + mNewsVo.title); intent.putExtra(Intent.EXTRA_TEXT, mNewsVo.articleUrl); return intent; }
From source file:com.hijacker.FeedbackDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); dialogView = getActivity().getLayoutInflater().inflate(R.layout.feedback_dialog, null); emailView = (EditText) dialogView.findViewById(R.id.email_et); include_report = (CheckBox) dialogView.findViewById(R.id.include_report); feedbackView = (EditText) dialogView.findViewById(R.id.feedback_et); progress = (ProgressBar) dialogView.findViewById(R.id.progress); emailView.setText(pref.getString("user_email", "")); emailView.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override//from w ww .ja v a2 s . c o m public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_NEXT) { feedbackView.requestFocus(); return true; } return false; } }); report = null; include_report.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked && report == null) { progress.setIndeterminate(true); new Thread(new Runnable() { @Override public void run() { report = new File(Environment.getExternalStorageDirectory() + "/report.txt"); if (!createReport(report, path, null, Shell.getFreeShell().getShell())) { if (debug) Log.e("HIJACKER/feedbackDialog", "Report not generated"); report = null; } runInHandler(new Runnable() { @Override public void run() { progress.setIndeterminate(false); } }); } }).start(); } } }); builder.setView(dialogView); builder.setTitle(getString(R.string.feedback)); builder.setPositiveButton(R.string.send, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder.setNeutralButton(R.string.send_email, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("plain/text"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "kiriakopoulos44@gmail.com" }); intent.putExtra(Intent.EXTRA_SUBJECT, "Hijacker feedback"); if (report != null) { Uri attachment = FileProvider.getUriForFile( FeedbackDialog.this.getActivity().getApplicationContext(), BuildConfig.APPLICATION_ID + ".provider", report); intent.putExtra(Intent.EXTRA_STREAM, attachment); } intent.putExtra(Intent.EXTRA_TEXT, feedbackView.getText().toString()); startActivity(intent); } }); return builder.create(); }
From source file:com.hacktx.android.activities.EventDetailActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish();/*w ww . ja v a 2 s. c o m*/ return true; case R.id.action_map: Bundle b = new Bundle(); b.putString(getString(R.string.analytics_param_event_name), event.getName()); mMetricsManager.logEvent(R.string.analytics_event_map, b); Intent intent = new Intent(this, MainActivity.class); intent.putExtra("open", "maps"); startActivity(intent); return true; case R.id.action_share: Bundle b2 = new Bundle(); b2.putString(getString(R.string.analytics_param_event_name), event.getName()); mMetricsManager.logEvent(R.string.analytics_event_share, b2); String shareBody = getString(R.string.event_share_body, event.getName()); Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.event_share_subject)); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); startActivity(Intent.createChooser(sharingIntent, getString(R.string.event_share_dialog_title))); return true; } return super.onOptionsItemSelected(item); }
From source file:palamarchuk.smartlife.app.fragments.ProfileFragment.java
private void feedback() { Intent sendIntent;//from w w w. j av a2 s. c o m sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "support@smartlife.com.kz" }); sendIntent.putExtra(Intent.EXTRA_SUBJECT, ""); sendIntent.putExtra(Intent.EXTRA_TEXT, ""); sendIntent.setType("image/jpeg"); try { startActivity(Intent.createChooser(sendIntent, "Send Mail")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(parentActivity, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } }
From source file:codepath.watsiapp.utils.Util.java
private static void startShareIntentWithExplicitSocialActivity(Activity ctx, ShareableItem patient, Set<String> socialActivitiesName, String displayName) { Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, patient.getShareableUrl()); try {//ww w . jav a 2 s . com final PackageManager pm = ctx.getPackageManager(); final List activityList = pm.queryIntentActivities(shareIntent, 0); int len = activityList.size(); for (int i = 0; i < len; i++) { final ResolveInfo app = (ResolveInfo) activityList.get(i); Log.d("#####################", app.activityInfo.name); if (socialActivitiesName.contains(app.activityInfo.name)) { final ActivityInfo activity = app.activityInfo; final ComponentName name = new ComponentName(activity.applicationInfo.packageName, activity.name); shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Fund Treatment"); shareIntent.addCategory(Intent.CATEGORY_LAUNCHER); shareIntent.setComponent(name); ctx.startActivity(shareIntent); break; } } } catch (final ActivityNotFoundException e) { Toast.makeText(ctx, "Could not find " + displayName + " app", Toast.LENGTH_SHORT).show(); } }
From source file:com.example.xyzreader.ui.articledetail.ArticleDetailFragment.java
private void sendArticle() { if (mCursor != null) { String title = mCursor.getString(ArticleLoader.Query.TITLE); String byline = ((TextView) mRootView.findViewById(R.id.article_detail_byline)).getText().toString(); Spanned textBody = Html.fromHtml(mCursor.getString(ArticleLoader.Query.BODY)); String photoUrl = mCursor.getString(ArticleLoader.Query.PHOTO_URL); Intent intent = new Intent(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); }//from w w w. j a v a2 s .c o m intent.setAction(Intent.ACTION_SEND); intent.setType("text/*"); intent.putExtra(Intent.EXTRA_SUBJECT, title); intent.putExtra(Intent.EXTRA_TEXT, title + "\n" + byline + "\n\n" + photoUrl + "\n\n" + textBody + "\n\n#" + mContext.getString(R.string.app_name)); ShareActionProvider shareActionProvider = new ShareActionProvider(mContext); shareActionProvider.setShareIntent(intent); startActivity(intent); } }
From source file:com.gh4a.activities.DiffViewerActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { String url = "https://github.com/" + mRepoOwner + "/" + mRepoName + "/commit/" + mSha; switch (item.getItemId()) { case R.id.browser: IntentUtils.launchBrowser(this, Uri.parse(url)); return true; case R.id.share: Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_commit_subject, mSha.substring(0, 7), mRepoOwner + "/" + mRepoName)); shareIntent.putExtra(Intent.EXTRA_TEXT, url); shareIntent = Intent.createChooser(shareIntent, getString(R.string.share_title)); startActivity(shareIntent);/*from w w w .ja v a 2s . c om*/ return true; case MENU_ITEM_VIEW: startActivity(IntentUtils.getFileViewerActivityIntent(this, mRepoOwner, mRepoName, mSha, mPath)); return true; } return super.onOptionsItemSelected(item); }
From source file:com.luan.thermospy.android.fragments.temperaturelog.TemperatureGraph.java
private Intent createShareIntent() { File outputDir = getActivity().getExternalCacheDir(); // context being the Activity pointer File outputFile = null;// w ww . j a va2 s. c om try { outputFile = File.createTempFile("export", ".csv", outputDir); BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(outputFile.getAbsolutePath())); for (TemperatureEntry entry : mTemperatureList) { writer.write(entry.toCsv() + "\n"); } writer.flush(); } catch (IOException e) { } finally { try { if (writer != null) writer.close(); } catch (IOException e) { } } } catch (IOException e) { e.printStackTrace(); } if (outputFile != null) { Uri u1 = Uri.fromFile(outputFile); Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Temperature log from Thermospy"); sendIntent.putExtra(Intent.EXTRA_STREAM, u1); sendIntent.setType("application/csv"); sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); return sendIntent; } return null; }
From source file:com.github.dfa.diaspora_android.activity.DiasporaStreamFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { AppLog.d(this, "StreamFragment.onOptionsItemSelected()"); ShareUtil shu = new ShareUtil(getContext()).setFileProviderAuthority(BuildConfig.APPLICATION_ID); PermissionChecker permc = new PermissionChecker(getActivity()); switch (item.getItemId()) { case R.id.action_reload: { if (WebHelper.isOnline(getContext())) { reloadUrl();/*from w w w.jav a 2 s . c o m*/ return true; } else { return false; } } case R.id.action_go_to_top: { ObjectAnimator anim = ObjectAnimator.ofInt(webView, "scrollY", webView.getScrollY(), 0); anim.setDuration(400); anim.start(); return true; } case R.id.action_share_link: { Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(Intent.EXTRA_SUBJECT, webView.getTitle()); sharingIntent.putExtra(Intent.EXTRA_TEXT, webView.getUrl()); startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.share_dotdotdot))); return true; } case R.id.action_share_pdf: { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { shu.createPdf(webView, "dandelion-" + ShareUtil.SDF_SHORT.format(new Date())); } return true; } case R.id.action_share_link_to_clipboard: { shu.setClipboard(webView.getUrl()); Toast.makeText(getContext(), R.string.link_adress_copied, Toast.LENGTH_SHORT).show(); return true; } case R.id.action_create_launcher_shortcut: { if (webView.getUrl() != null) { Intent intent = new Intent(getContext(), MainActivity.class); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse(webView.getUrl())); shu.createLauncherDesktopShortcut(intent, R.drawable.ic_launcher, webView.getTitle()); } return true; } case R.id.action_take_screenshot: { if (permc.doIfExtStoragePermissionGranted(getString(R.string.screenshot_permission__appspecific))) { File fileSaveDirectory = appSettings.getAppSaveDirectory(); if (permc.mkdirIfStoragePermissionGranted(fileSaveDirectory)) { Bitmap bmp = ShareUtil.getBitmapFromWebView(webView); String filename = "dandelion-" + ShareUtil.SDF_SHORT.format(new Date()) + ".jpg"; _cu.writeImageToFileJpeg(new File(fileSaveDirectory, filename), bmp); Snackbar.make(webView, getString(R.string.saving_screenshot_as) + " " + filename, Snackbar.LENGTH_LONG).show(); } } return true; } case R.id.action_share_screenshot: { if (permc.doIfExtStoragePermissionGranted(getString(R.string.screenshot_permission__appspecific))) { shu.shareImage(ShareUtil.getBitmapFromWebView(webView), Bitmap.CompressFormat.JPEG); } return true; } } return super.onOptionsItemSelected(item); }
From source file:com.farmerbb.notepad.activity.NoteEditActivity.java
private String getExternalContent() { String text = getIntent().getStringExtra(Intent.EXTRA_TEXT); if (text == null) return null; String subject = getIntent().getStringExtra(Intent.EXTRA_SUBJECT); if (subject == null) return text; return subject + "\n\n" + text; }