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.jahirfiquitiva.paperboard.activities.Main.java
@Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { case R.id.share: Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); String shareBody = "Check out this awesome icon pack by " + getResources().getString(R.string.iconpack_designer) + ". Download Here: " + getResources().getString(R.string.play_store_link); sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody); startActivity(Intent.createChooser(sharingIntent, (getResources().getString(R.string.share_title)))); break;/* w w w. ja v a 2 s. co m*/ case R.id.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: " + System.getProperty("os.version") + "(" + Build.VERSION.INCREMENTAL + ")"); emailBuilder.append("\nOS API Level: " + Build.VERSION.SDK_INT); emailBuilder.append("\nDevice: " + Build.DEVICE); emailBuilder.append("\nManufacturer: " + Build.MANUFACTURER); emailBuilder.append("\nModel (and Product): " + Build.MODEL + " (" + Build.PRODUCT + ")"); PackageInfo appInfo = null; try { appInfo = getPackageManager().getPackageInfo(getPackageName(), 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } emailBuilder.append("\nApp Version Name: " + appInfo.versionName); emailBuilder.append("\nApp Version Code: " + appInfo.versionCode); intent.putExtra(Intent.EXTRA_TEXT, emailBuilder.toString()); startActivity(Intent.createChooser(intent, (getResources().getString(R.string.send_title)))); break; case R.id.changelog: changelog(); break; } return true; }
From source file:bupt.tiantian.callrecorder.callrecorder.MainActivity.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 == R.id.action_settings) { Intent intent = new Intent(this, SettingsActivity.class); intent.putExtra("write_external", permissionWriteExternal); startActivity(intent);//from w w w. j a v a2 s. c o m return true; } if (id == R.id.action_save) { if (null != selectedItems && selectedItems.length > 0) { Runnable runnable = new Runnable() { @Override public void run() { for (PhoneCallRecord record : selectedItems) { record.getPhoneCall().setKept(true); record.getPhoneCall().save(MainActivity.this); } LocalBroadcastManager.getInstance(MainActivity.this) .sendBroadcast(new Intent(LocalBroadcastActions.NEW_RECORDING_BROADCAST)); // Causes refresh } }; handler.post(runnable); } return true; } if (id == R.id.action_share) { if (null != selectedItems && selectedItems.length > 0) { Runnable runnable = new Runnable() { @Override public void run() { ArrayList<Uri> fileUris = new ArrayList<Uri>(); for (PhoneCallRecord record : selectedItems) { fileUris.add(Uri.fromFile(new File(record.getPhoneCall().getPathToRecording()))); } Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE); shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, fileUris); shareIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.email_title)); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { shareIntent.putExtra(Intent.EXTRA_HTML_TEXT, Html.fromHtml(getString(R.string.email_body_html), Html.FROM_HTML_MODE_LEGACY)); } else { shareIntent.putExtra(Intent.EXTRA_HTML_TEXT, Html.fromHtml(getString(R.string.email_body_html))); } shareIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.email_body)); shareIntent.setType("audio/*"); startActivity(Intent.createChooser(shareIntent, getString(R.string.action_share))); } }; handler.post(runnable); } return true; } if (id == R.id.action_delete) { if (null != selectedItems && selectedItems.length > 0) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.delete_recording_title); alert.setMessage(R.string.delete_recording_subject); alert.setPositiveButton(R.string.dialog_yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Runnable runnable = new Runnable() { @Override public void run() { Database callLog = Database.getInstance(MainActivity.this); for (PhoneCallRecord record : selectedItems) { int id = record.getPhoneCall().getId(); callLog.removeCall(id); } LocalBroadcastManager.getInstance(MainActivity.this).sendBroadcast( new Intent(LocalBroadcastActions.RECORDING_DELETED_BROADCAST)); //?selectedItems onListFragmentInteraction(new PhoneCallRecord[] {}); } }; handler.post(runnable); dialog.dismiss(); } }); alert.setNegativeButton(R.string.dialog_no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alert.show(); } return true; } if (id == R.id.action_delete_all) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.delete_recording_title); alert.setMessage(R.string.delete_all_recording_subject); alert.setPositiveButton(R.string.dialog_yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Runnable runnable = new Runnable() { @Override public void run() { Database.getInstance(MainActivity.this).removeAllCalls(false); LocalBroadcastManager.getInstance(getApplicationContext()) .sendBroadcast(new Intent(LocalBroadcastActions.RECORDING_DELETED_BROADCAST)); //?selectedItems onListFragmentInteraction(new PhoneCallRecord[] {}); } }; handler.post(runnable); dialog.dismiss(); } }); alert.setNegativeButton(R.string.dialog_no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alert.show(); return true; } if (R.id.action_whitelist == id) { if (permissionReadContacts) { Intent intent = new Intent(this, WhitelistActivity.class); startActivity(intent); } else { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.permission_whitelist_title); alert.setMessage(R.string.permission_whitelist); } return true; } return super.onOptionsItemSelected(item); }
From source file:at.alladin.rmbt.android.about.RMBTAboutFragment.java
private View createView(View view, LayoutInflater inflater) { activity = getActivity();/*from w ww . ja v a 2 s.c o m*/ getAppInfo(activity); final String clientUUID = String.format("U%s", ConfigHelper.getUUID(activity.getApplicationContext())); final String controlServerVersion = ConfigHelper.getControlServerVersion(activity); final ListView listView = (ListView) view.findViewById(R.id.aboutList); final ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>(); HashMap<String, String> item; item = new HashMap<String, String>(); item.put("title", clientName); item.put("text1", this.getString(R.string.about_rtr_line1)); list.add(item); item = new HashMap<String, String>(); item.put("title", this.getString(R.string.about_version_title)); item.put("text1", clientVersion); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_clientid_title)); item.put("text1", clientUUID); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_web_title)); item.put("text1", getString(R.string.about_web_line1)); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_email_title)); item.put("text1", getString(R.string.about_email_line1)); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_terms_title)); item.put("text1", getString(R.string.about_terms_line1)); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_git_title)); item.put("text1", getString(R.string.about_git_line1)); item.put("text2", ""); list.add(item); item = new HashMap<String, String>(); item.put("title", getString(R.string.about_dev_title)); item.put("text1", getString(R.string.about_dev_line1)); item.put("text2", getString(R.string.about_dev_line2)); list.add(item); final String openSourceSoftwareLicenseInfo = GooglePlayServicesUtil .getOpenSourceSoftwareLicenseInfo(getActivity()); if (openSourceSoftwareLicenseInfo != null) { item = new HashMap<String, String>(); item.put("title", getString(R.string.about_gms_legal_title)); item.put("text1", getString(R.string.about_gms_legal_line1)); item.put("text2", ""); list.add(item); } if (ConfigHelper.isDevEnabled(getActivity())) { item = new HashMap<String, String>(); item.put("title", getString(R.string.about_test_counter_title)); item.put("text1", Integer.toString(ConfigHelper.getTestCounter(getActivity()))); item.put("text2", ""); list.add(item); } item = new HashMap<String, String>(); item.put("title", getString(R.string.about_control_server_version)); item.put("text1", controlServerVersion != null ? controlServerVersion : "---"); item.put("text2", ""); list.add(item); sa = new RMBTAboutAdapter(getActivity(), list, R.layout.about_item, new String[] { "title", "text1", "text2" }, new int[] { R.id.title, R.id.text1, R.id.text2 }); listView.setAdapter(sa); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(final AdapterView<?> l, final View v, final int position, final long id) { switch (position) { case 1: handleHiddenCode(); break; case 2: final android.content.ClipboardManager clipBoard = (android.content.ClipboardManager) getActivity() .getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("client_uuid", clientUUID); clipBoard.setPrimaryClip(clip); final Toast toast = Toast.makeText(getActivity(), R.string.about_clientid_toast, Toast.LENGTH_LONG); toast.show(); break; case 3: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.about_web_link)))); break; case 4: /* Create the Intent */ final Intent emailIntent = new Intent(Intent.ACTION_SEND); /* Fill it with Data */ emailIntent.setType("plain/text"); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { getString(R.string.about_email_email) }); emailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.about_email_subject)); emailIntent.putExtra(Intent.EXTRA_TEXT, ""); /* Send it off to the Activity-Chooser */ startActivity(Intent.createChooser(emailIntent, getString(R.string.about_email_sending))); break; case 5: final FragmentManager fm = activity.getSupportFragmentManager(); FragmentTransaction ft; ft = fm.beginTransaction(); ft.replace(R.id.fragment_content, new RMBTTermsFragment(), "terms"); ft.addToBackStack("terms"); ft.commit(); break; case 6: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.about_git_link)))); break; case 7: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.about_dev_link)))); break; case 8: final String licenseInfo = GooglePlayServicesUtil .getOpenSourceSoftwareLicenseInfo(getActivity()); AlertDialog.Builder licenseDialog = new AlertDialog.Builder(getActivity()); licenseDialog.setMessage(licenseInfo); licenseDialog.show(); break; default: break; } } }); return view; }
From source file:com.google.android.apps.location.gps.gnsslogger.FileLogger.java
/** * Send the current log via email or other options selected from a pop menu shown to the user. A * new log is started when calling this function. *//* w w w . ja v a2 s . co m*/ public void send() { if (mFile == null) { return; } Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setType("*/*"); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "SensorLog"); emailIntent.putExtra(Intent.EXTRA_TEXT, ""); // attach the file Uri fileURI = FileProvider.getUriForFile(mContext, BuildConfig.APPLICATION_ID + ".provider", mFile); emailIntent.putExtra(Intent.EXTRA_STREAM, fileURI); getUiComponent().startActivity(Intent.createChooser(emailIntent, "Send log..")); if (mFileWriter != null) { try { mFileWriter.flush(); mFileWriter.close(); mFileWriter = null; } catch (IOException e) { logException("Unable to close all file streams.", e); return; } } }
From source file:com.zia.freshdocs.widget.adapter.CMISAdapter.java
/** * Send the content using a built-in Android activity which can handle the * content type./*from w w w . j av a 2 s .c o m*/ * * @param position */ public void shareContent(int position) { final NodeRef ref = getItem(position); downloadContent(ref, new Handler() { public void handleMessage(Message msg) { Context context = getContext(); boolean done = msg.getData().getBoolean("done"); if (done) { dismissProgressDlg(); File file = (File) mDlThread.getResult(); if (file != null) { Resources res = context.getResources(); Uri uri = Uri.fromFile(file); Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.putExtra(Intent.EXTRA_STREAM, uri); emailIntent.putExtra(Intent.EXTRA_SUBJECT, ref.getName()); emailIntent.putExtra(Intent.EXTRA_TEXT, res.getString(R.string.email_text)); emailIntent.setType(ref.getContentType()); try { context.startActivity( Intent.createChooser(emailIntent, res.getString(R.string.email_title))); } catch (ActivityNotFoundException e) { String text = "No suitable applications registered to send " + ref.getContentType(); int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } } } else { int value = msg.getData().getInt("progress"); if (value > 0) { mProgressDlg.setProgress(value); } } } }); }
From source file:com.achep.base.ui.fragments.dialogs.FeedbackDialog.java
private void send(@NonNull CharSequence title, @NonNull CharSequence body, boolean attachLog) { Activity context = getActivity();/*from www. j a v a2 s .co m*/ String[] recipients = { Build.SUPPORT_EMAIL }; Intent intent = new Intent().putExtra(Intent.EXTRA_EMAIL, recipients).putExtra(Intent.EXTRA_SUBJECT, title) .putExtra(Intent.EXTRA_TEXT, body); if (attachLog) { attachLog(intent); intent.setAction(Intent.ACTION_SEND); intent.setType("message/rfc822"); } else { intent.setAction(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:")); // only email apps should handle it } if (IntentUtils.hasActivityForThat(context, intent)) { startActivity(intent); dismiss(); } else { ToastUtils.showLong(context, R.string.feedback_error_no_app); } }
From source file:com.altcanvas.twitspeak.TwitSpeakActivity.java
public boolean checkStackTrace() { FileInputStream traceIn = null; try {/*from w ww . j av a 2s . c o m*/ traceIn = openFileInput("stack.trace"); traceIn.close(); } catch (FileNotFoundException fnfe) { // No stack trace available return false; } catch (IOException ioe) { return false; } AlertDialog alert = new AlertDialog.Builder(this).create(); alert.setMessage(getResources().getString(R.string.crashreport_msg)); alert.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.emailstr), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String trace = ""; String line = null; try { BufferedReader reader = new BufferedReader( new InputStreamReader(TwitSpeakActivity.this.openFileInput("stack.trace"))); while ((line = reader.readLine()) != null) { trace += line + "\n"; } } catch (FileNotFoundException fnfe) { Log.logException(TAG, fnfe); } catch (IOException ioe) { Log.logException(TAG, ioe); } Intent sendIntent = new Intent(Intent.ACTION_SEND); String subject = "Error report"; String body = getResources().getString(R.string.mailthisto_msg) + " jayesh@altcanvas.com: " + "\n\n" + G.getPhoneInfo() + "\n\n" + "TwitSpeak [" + G.VERSION_STRING + "]" + "\n\n" + trace + "\n\n"; sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "jayesh@altcanvas.com" }); sendIntent.putExtra(Intent.EXTRA_TEXT, body); sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject); sendIntent.setType("message/rfc822"); TwitSpeakActivity.this.startActivityForResult( Intent.createChooser(sendIntent, getResources().getString(R.string.emailstr)), G.REQCODE_EMAIL_STACK_TRACE); TwitSpeakActivity.this.deleteFile("stack.trace"); } }); alert.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.cancelstr), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { TwitSpeakActivity.this.deleteFile("stack.trace"); TwitSpeakActivity.this.continueOnCreate(); } }); alert.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { TwitSpeakActivity.this.deleteFile("stack.trace"); TwitSpeakActivity.this.continueOnCreate(); } }); alert.show(); return true; }
From source file:com.pranavpandey.smallapp.sample.SmallAppSample.java
private void share() { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, R.string.app_name); intent.putExtra(Intent.EXTRA_BCC, ""); intent.putExtra(Intent.EXTRA_TEXT, "Create advanced small apps for Sony devices with" + " Small App Support library.\n\n" + SOURCES_LINK); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this).setTitle(R.string.sas_share) .setNegativeButton(android.R.string.cancel, null); new OpenIntentDialog(getContext(), intent, alertDialogBuilder, Type.LIST).setRememberSelection(true) .setActivityOpenListener(new OnActivityOpenListener() { public void onActivityOpen(ComponentName componentName) { windowMinimize();/*from w w w . j a v a 2s .c o m*/ } }).setExtraInfo(R.drawable.sas_ic_action_link, SOURCES_LINK, null).show(getRootView()); }
From source file:com.flipzu.flipzu.Profile.java
private void share() { if (mUser == null) return;/* w ww . j av a 2 s . c om*/ //create the intent Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); //set the type shareIntent.setType("text/plain"); //add a subject shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mUser.getFullname() + " live on FlipZu"); //build the body of the message to be shared String shareMessage = mUser.getUsername() + " profile on Flipzu: http://flipzu.com/" + mUser.getUsername(); //add the message shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareMessage); //start the chooser for sharing startActivity(Intent.createChooser(shareIntent, getText(R.string.share_profile_with))); }