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:net.gromgull.android.bibsonomyposter.BibsonomyPosterActivity.java
/** Called with the activity is first created. */ @Override//from w ww . ja va 2 s.c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); load(); Intent intent = getIntent(); String action = intent.getAction(); if (action.equalsIgnoreCase(Intent.ACTION_SEND)) { final String uri = intent.getStringExtra(Intent.EXTRA_TEXT); final String title = intent.getStringExtra(Intent.EXTRA_SUBJECT); final Context context = getApplicationContext(); new AsyncTask<Void, Integer, Boolean>() { @Override protected Boolean doInBackground(Void... v) { try { bookmark(uri, title); return true; } catch (Exception e) { Log.w(LOGTAG, "Could not bookmark: " + title + " / " + uri, e); return false; } } protected void onPostExecute(Boolean result) { if (result) { Toast toast = Toast.makeText(context, "Bookmarked " + title, Toast.LENGTH_SHORT); toast.show(); } else { Toast toast = Toast.makeText(context, "Error bookmarking " + title, Toast.LENGTH_SHORT); toast.show(); } } }.execute(); finish(); return; } // Inflate our UI from its XML layout description. setContentView(R.layout.bibsonomyposter_activity); if (username != null) ((EditText) findViewById(R.id.username)).setText(username); if (apikey != null) ((EditText) findViewById(R.id.apikey)).setText(apikey); // Hook up button presses to the appropriate event handler. ((Button) findViewById(R.id.save)).setOnClickListener(mSaveListener); }
From source file:com.marcosedo.lagramola.HelpFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.help, container, false); //////////LISTVIEW, ADAPTER Y TEXTO DE LOS MENUS final Resources resources = getResources(); listView = (ListView) view.findViewById(android.R.id.list); List<Map<String, String>> data = new ArrayList<Map<String, String>>(); String[] titles_str = { resources.getString(R.string.appVersionTxt), resources.getString(R.string.feedbackMail), resources.getString(R.string.OSLicenses) }; String[] subtitles_str = { resources.getString(R.string.appVersionNumber), resources.getString(R.string.myEmailAddress), "" }; for (int i = 0; i < titles_str.length; i++) { Map<String, String> datum = new HashMap<String, String>(2); datum.put("title", titles_str[i]); datum.put("subtitle", subtitles_str[i]); data.add(datum);/*from w w w .j a v a2 s .com*/ } SimpleAdapter adapter = new SimpleAdapter(getActivity(), data, android.R.layout.simple_list_item_2, new String[] { "title", "subtitle" }, new int[] { android.R.id.text1, android.R.id.text2 }); listView.setAdapter(adapter); //LISTENER DEL LIST VIEW esto nos saca el context menu con un solo click listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterview, View v, int position, long arg3) { Resources resource = getActivity().getResources(); switch (position) { case 1: Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", Constantes.MY_EMAIL, null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject"); emailIntent.putExtra(Intent.EXTRA_TEXT, "Body"); startActivity(Intent.createChooser(emailIntent, "Enviar email...")); break; case 2: String LicenseInfo = resource.getString(R.string.headerOSLicenses) + GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getActivity()); AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(getActivity()); LicenseDialog.setTitle(resource.getString(R.string.OSLicenses)); if (LicenseInfo != null) { LicenseDialog.setMessage(LicenseInfo); LicenseDialog.show(); break; } } } }); return view; }
From source file:net.bible.android.control.page.PageControl.java
/** send the current verse via social applications installed on user's device *//*w w w .ja v a2 s. c om*/ public void shareVerse() { try { Book book = getCurrentPageManager().getCurrentPage().getCurrentDocument(); Key key = getCurrentPageManager().getCurrentPage().getSingleKey(); String text = key.getName() + "\n" + SwordContentFacade.getInstance().getCanonicalText(book, key); Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.setType("text/plain"); sendIntent.putExtra(Intent.EXTRA_TEXT, text); // subject is used when user chooses to send verse via e-mail sendIntent.putExtra(Intent.EXTRA_SUBJECT, BibleApplication.getApplication().getText(R.string.share_verse_subject)); Activity activity = CurrentActivityHolder.getInstance().getCurrentActivity(); activity.startActivity(Intent.createChooser(sendIntent, activity.getString(R.string.share_verse))); } catch (Exception e) { Log.e(TAG, "Error sharing verse", e); Dialogs.getInstance().showErrorMsg("Error sharing verse"); } }
From source file:com.bellman.bible.android.control.page.PageControl.java
/** send the current verse via social applications installed on user's device *//*w ww .j av a 2s .c o m*/ public void shareVerse(VerseRange verseRange) { try { Book book = getCurrentPageManager().getCurrentPage().getCurrentDocument(); String text = verseRange.getName() + "\n" + SwordContentFacade.getInstance().getCanonicalText(book, verseRange); Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.setType("text/plain"); sendIntent.putExtra(Intent.EXTRA_TEXT, text); // subject is used when user chooses to send verse via e-mail sendIntent.putExtra(Intent.EXTRA_SUBJECT, CurrentActivityHolder.getInstance().getApplication().getText(R.string.share_verse_subject)); Activity activity = CurrentActivityHolder.getInstance().getCurrentActivity(); activity.startActivity(Intent.createChooser(sendIntent, activity.getString(R.string.share_verse))); } catch (Exception e) { Log.e(TAG, "Error sharing verse", e); Dialogs.getInstance().showErrorMsg("Error sharing verse"); } }
From source file:com.github.fi3te.iliasdownloader.view.util.MenuItemSelectedUtil.java
public static boolean onOptionsItemSelected(final FragmentActivity activity, MenuItem item) { int id = item.getItemId(); switch (id) { case R.id.coursesItem: FragmentManager fm = activity.getSupportFragmentManager(); Fragment loadCoursesTask = new LoadCoursesDialogFragment(); fm.beginTransaction().add(loadCoursesTask, IliasActivity.TASK_FRAGMENT_TAG).commit(); fm.executePendingTransactions(); return true; case R.id.licencesItem: activity.startActivity(new Intent(activity, LicensesActivity.class)); return true; case R.id.imprintItem: DialogUtil.showImprint(activity); return true; case R.id.aboutItem: String version = null;/*from w w w .j a va 2 s .c o m*/ try { PackageInfo packageInfo = activity.getPackageManager().getPackageInfo(activity.getPackageName(), 0); version = packageInfo.versionName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } final String v = (version == null) ? "" : (" " + version); new MaterialDialog.Builder(activity).icon(activity.getResources().getDrawable(R.mipmap.ic_launcher)) .title(activity.getResources().getString(R.string.about)) .content(activity.getResources().getString(R.string.app_name) + ((version != null) ? (" " + version) : "") + "\n" + "Fiete Wennier" + "\n" + "https://github.com/fi3te/ILIASDownloaderAndroid") .positiveText(activity.getResources().getString(R.string.support)) .callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog dialog) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "fiete.wennier@gmail.com", null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, activity.getResources().getString(R.string.app_name) + v); activity.startActivity(Intent.createChooser(emailIntent, "E-Mail")); dialog.cancel(); } }).show(); return true; } return false; }
From source file:com.lauszus.dronedraw.DroneDrawActivity.java
private void sendEmail(File file) { Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setType("vnd.android.cursor.dir/email"); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "lauszus@gmail.com" }); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Drone path"); emailIntent.putExtra(Intent.EXTRA_TEXT, "Please see attachment"); emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); if (emailIntent.resolveActivity(getPackageManager()) != null) { // Make sure that an app exist that can handle the intent startActivity(emailIntent);/*w ww . jav a 2s. c o m*/ } else Toast.makeText(getApplicationContext(), "No email app found", Toast.LENGTH_SHORT).show(); }
From source file:im.delight.android.commons.Social.java
/** * Displays an application chooser and shares the specified file using the selected application * * @param context a context reference//w w w . j av a2 s . c om * @param windowTitle the title for the application chooser's window * @param fileToShare the file to be shared * @param mimeTypeForFile the MIME type for the file to be shared (e.g. `image/jpeg`) * @param subjectTextToShare the message title or subject for the file, if supported by the target application */ public static void shareFile(final Context context, final String windowTitle, final File fileToShare, final String mimeTypeForFile, final String subjectTextToShare) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setType(mimeTypeForFile); intent.putExtra(Intent.EXTRA_SUBJECT, subjectTextToShare); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(fileToShare)); context.startActivity(Intent.createChooser(intent, windowTitle)); }
From source file:bg.tudle.mtbtimer.ui.MTBMainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SENDTO); intent.setType("text/plain"); switch (item.getItemId()) { case R.id.menu_feedback: intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.send_from_my_android)); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name)); intent.setData(Uri.parse(getString(R.string.mailto_dimitarniknikolov_gmail_com))); break;/*from w ww. ja va 2s . c o m*/ case R.id.menu_share: intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.download_apk_link_) + DOWNLOAD_APP_LINK + getString(R.string.send_from_my_android)); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.checkout_mtbtimer_for_android)); intent.setData(Uri.parse("mailto:")); break; case R.id.menu_about: try { PackageManager manager = getPackageManager(); PackageInfo info = manager.getPackageInfo(getPackageName(), 0); String aboutMsg = getString(R.string.versioncode_) + info.versionCode + getString(R.string._versionname_) + info.versionName; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.app_name).setMessage(aboutMsg).setNeutralButton(R.string.ok, null).show(); } catch (NameNotFoundException e) { e.printStackTrace(); } return true; default: break; } startActivity(intent); return super.onOptionsItemSelected(item); }
From source file:com.granita.tasks.EditTaskActivity.java
@TargetApi(11) @Override/*from w ww . jav a 2 s .co m*/ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_task_editor); mAuthority = getString(R.string.org_dmfs_tasks_authority); //custom start Tracker t = ((com.granita.tasks.Tasks) getApplication()) .getTracker(com.granita.tasks.Tasks.TrackerName.APP_TRACKER); t.setScreenName("Tasks: Edit task activity"); t.send(new HitBuilders.AppViewBuilder().build()); //custom end if (android.os.Build.VERSION.SDK_INT >= 11) { // hide up button in action bar ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(R.drawable.content_remove_light); // actionBar.setDisplayShowTitleEnabled(false); } if (savedInstanceState == null) { Bundle arguments = new Bundle(); Intent intent = getIntent(); String action = intent.getAction(); setActivityTitle(action); if (Intent.ACTION_SEND.equals(action)) { // load data from incoming share intent ContentSet sharedContentSet = new ContentSet(Tasks.getContentUri(mAuthority)); if (intent.hasExtra(Intent.EXTRA_SUBJECT)) { sharedContentSet.put(Tasks.TITLE, intent.getStringExtra(Intent.EXTRA_SUBJECT)); } if (intent.hasExtra(Intent.EXTRA_TITLE)) { sharedContentSet.put(Tasks.TITLE, intent.getStringExtra(Intent.EXTRA_TITLE)); } if (intent.hasExtra(Intent.EXTRA_TEXT)) { String extraText = intent.getStringExtra(Intent.EXTRA_TEXT); sharedContentSet.put(Tasks.DESCRIPTION, extraText); // check if supplied text is a URL if (extraText.startsWith("http://") && !extraText.contains(" ")) { sharedContentSet.put(Tasks.URL, extraText); } } // hand over shared information to EditTaskFragment arguments.putParcelable(EditTaskFragment.PARAM_CONTENT_SET, sharedContentSet); } else if (ACTION_NOTE_TO_SELF.equals(action)) { // process the note to self intent ContentSet sharedContentSet = new ContentSet(Tasks.getContentUri(mAuthority)); if (intent.hasExtra(Intent.EXTRA_SUBJECT)) { sharedContentSet.put(Tasks.DESCRIPTION, intent.getStringExtra(Intent.EXTRA_SUBJECT)); } if (intent.hasExtra(Intent.EXTRA_TEXT)) { String extraText = intent.getStringExtra(Intent.EXTRA_TEXT); sharedContentSet.put(Tasks.TITLE, extraText); } // add start time stamp sharedContentSet.put(Tasks.DTSTART, System.currentTimeMillis()); sharedContentSet.put(Tasks.TZ, TimeZone.getDefault().getID()); // hand over shared information to EditTaskFragment arguments.putParcelable(EditTaskFragment.PARAM_CONTENT_SET, sharedContentSet); } else { // hand over task URI for editing / creating empty task arguments.putParcelable(EditTaskFragment.PARAM_TASK_URI, getIntent().getData()); ContentSet data = getIntent().getParcelableExtra(EXTRA_DATA_CONTENT_SET); if (data != null) { arguments.putParcelable(EditTaskFragment.PARAM_CONTENT_SET, data); } String accountType = getIntent().getStringExtra(EXTRA_DATA_ACCOUNT_TYPE); if (accountType != null) { arguments.putString(EditTaskFragment.PARAM_ACCOUNT_TYPE, accountType); } } EditTaskFragment fragment = new EditTaskFragment(); fragment.setArguments(arguments); getSupportFragmentManager().beginTransaction().add(R.id.add_task_container, fragment).commit(); } }