List of usage examples for android.content Intent EXTRA_TEXT
String EXTRA_TEXT
To view the source code for android.content Intent EXTRA_TEXT.
Click Source Link
From source file:com.crowflying.buildwatch.ConfigurationActivity.java
@Override public boolean onPreferenceClick(Preference preference) { Log.d(LOG_TAG, String.format("Preference %s was clicked...", preference.getKey())); // Call the code for autosetup... if (PREFS_AUTOSETUP.equals(preference.getKey())) { Log.i(LOG_TAG, "Calling XZING."); tracker.trackEvent("configuration", "subscreen", "autosetup", 0L); IntentIntegrator integrator = new IntentIntegrator(this); integrator.setMessageByID(R.string.barcode_scanner_not_installed_message); integrator.initiateScan();/*w w w .j a v a 2 s . co m*/ return true; } if (PREFS_FORGET_SETTINGS.equals(preference.getKey())) { Log.i(LOG_TAG, "Forgetting all settings"); tracker.trackEvent("configuration", "action", "settings_cleared", 0L); PreferenceManager.getDefaultSharedPreferences(this).edit().clear().commit(); return true; } if (PREFS_KEY_LAUNCH_WEBSITE.equals(preference.getKey())) { Log.i(LOG_TAG, "Launching website"); Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(getString(R.string.config_launch_website_url))); startActivity(i); return true; } if (PREFS_KEY_GCM_TOKEN.equals(preference.getKey())) { String token = getPreferenceManager().getSharedPreferences().getString(PREFS_KEY_GCM_TOKEN, ""); if (!TextUtils.isEmpty(token)) { Log.i(LOG_TAG, "Token clicked. Echoing it to the logfile for convencience: " + token); Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.share_gcm_token_subject)); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, token); startActivity(Intent.createChooser(sharingIntent, getString(R.string.share_gcm_token_using))); } return true; } return false; }
From source file:com.digitalarx.android.files.FileOperationsHelper.java
private Intent createShareWithLinkIntent(String link) { Intent intentToShareLink = new Intent(Intent.ACTION_SEND); intentToShareLink.putExtra(Intent.EXTRA_TEXT, link); intentToShareLink.setType(HTTP.PLAIN_TEXT_TYPE); return intentToShareLink; }
From source file:ch.berta.fabio.popularmovies.presentation.ui.fragments.MovieDetailsBaseFragment.java
@Override public void setYoutubeShareUrl(@NonNull String url) { mShareYoutubeIntent.putExtra(Intent.EXTRA_TEXT, url); }
From source file:com.artemchep.horario.ui.dialogs.FeedbackDialog.java
private boolean send(@NonNull CharSequence title, @NonNull CharSequence body) { Activity activity = getActivity();//from w ww . ja v a2 s. co m String[] recipients = { Binfo.SUPPORT_EMAIL }; Intent intent = new Intent().putExtra(Intent.EXTRA_EMAIL, recipients).putExtra(Intent.EXTRA_SUBJECT, title) .putExtra(Intent.EXTRA_TEXT, body); intent.setAction(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:")); // only email apps should handle it try { startActivity(intent); return true; } catch (ActivityNotFoundException e) { Toasty.error(activity, getString(R.string.feedback_error_no_app), Toast.LENGTH_LONG).show(); return false; } }
From source file:com.xengar.android.booksearch.ui.BookDetailActivity.java
private void setShareIntent() { ImageView ivImage = (ImageView) findViewById(R.id.ivBookCover); final TextView tvTitle = (TextView) findViewById(R.id.tvTitle); // Get access to the URI for the bitmap Uri bmpUri = getLocalBitmapUri(ivImage); // Construct a ShareIntent with link to image Intent shareIntent = new Intent(); // Construct a ShareIntent with link to image shareIntent.setAction(Intent.ACTION_SEND); shareIntent.setType("*/*"); shareIntent.putExtra(Intent.EXTRA_TEXT, (String) tvTitle.getText()); shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri); // Launch share menu startActivity(Intent.createChooser(shareIntent, "Share Image")); }
From source file:co.nerdart.ourss.activity.EditFeedActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { UiUtils.setPreferenceTheme(this); super.onCreate(savedInstanceState); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); setContentView(R.layout.feed_edit);//from ww w .j a v a 2 s.c om setResult(RESULT_CANCELED); Intent intent = getIntent(); mNameEditText = (EditText) findViewById(R.id.feed_title); mUrlEditText = (EditText) findViewById(R.id.feed_url); mRetrieveFulltextCb = (CheckBox) findViewById(R.id.retrieve_fulltext); mFiltersListView = (ListView) findViewById(android.R.id.list); View filtersLayout = findViewById(R.id.filters_layout); View buttonLayout = findViewById(R.id.button_layout); if (intent.getAction().equals(Intent.ACTION_INSERT) || intent.getAction().equals(Intent.ACTION_SEND)) { setTitle(R.string.new_feed_title); filtersLayout.setVisibility(View.GONE); if (intent.hasExtra(Intent.EXTRA_TEXT)) { mUrlEditText.setText(intent.getStringExtra(Intent.EXTRA_TEXT)); } restoreInstanceState(savedInstanceState); } else if (intent.getAction().equals(Intent.ACTION_EDIT)) { setTitle(R.string.edit_feed_title); buttonLayout.setVisibility(View.GONE); mFiltersCursorAdapter = new FiltersCursorAdapter(this, null); mFiltersListView.setAdapter(mFiltersCursorAdapter); mFiltersListView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { startActionMode(mFilterActionModeCallback); mFiltersCursorAdapter.setSelectedFilter(position); mFiltersListView.invalidateViews(); return true; } }); getLoaderManager().initLoader(0, null, this); if (!restoreInstanceState(savedInstanceState)) { Cursor cursor = getContentResolver().query(intent.getData(), FEED_PROJECTION, null, null, null); if (cursor.moveToNext()) { mPreviousName = cursor.getString(0); mNameEditText.setText(mPreviousName); mUrlEditText.setText(cursor.getString(1)); mRetrieveFulltextCb.setChecked(cursor.getInt(2) == 1); cursor.close(); } else { cursor.close(); Crouton.makeText(EditFeedActivity.this, R.string.error, Style.INFO); finish(); } } } }
From source file:com.adkdevelopment.earthquakesurvival.ui.InfoFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.info_fragment, container, false); ImageView backdrop = ButterKnife.findById(getActivity(), R.id.backdrop); FloatingActionButton floatingActionButton = ButterKnife.findById(getActivity(), R.id.fab); mUnbinder = ButterKnife.bind(this, rootView); if (getActivity().getIntent() != null) { int section = getActivity().getIntent().getIntExtra(SurvivalFragment.SECTION, -1); List<String> titles = new ArrayList<>(); List<String> text = new ArrayList<>(); String title = ""; int drawable = -1; switch (section) { case 1:// ww w . j a v a2 s . c om titles.addAll(Arrays.asList(getResources().getStringArray(R.array.survival_before_title))); text.addAll(Arrays.asList(getResources().getStringArray(R.array.survival_before_text))); drawable = R.drawable.earth1; title = getString(R.string.survival_before); break; case 2: titles.addAll(Arrays.asList(getResources().getStringArray(R.array.survival_during_title))); text.addAll(Arrays.asList(getResources().getStringArray(R.array.survival_during_text))); drawable = R.drawable.earth2; title = getString(R.string.survival_during); break; case 3: titles.addAll(Arrays.asList(getResources().getStringArray(R.array.survival_after_title))); text.addAll(Arrays.asList(getResources().getStringArray(R.array.survival_after_text))); drawable = R.drawable.earth3; title = getString(R.string.survival_after); break; case 4: title = getString(R.string.survival_resources); titles.addAll(Arrays.asList(getResources().getStringArray(R.array.survival_resources_title))); text.addAll(Arrays.asList(getResources().getStringArray(R.array.survival_resources_text))); drawable = R.drawable.earth3; break; case 5: title = getString(R.string.survival_kit); titles.addAll(Arrays.asList(getResources().getStringArray(R.array.survival_kit_title))); text.addAll(Arrays.asList(getResources().getStringArray(R.array.survival_kit_text))); drawable = R.drawable.earth3; break; default: break; } RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false); InfoAdapter mRecentAdapter = new InfoAdapter(titles, text); mRecyclerView.setHasFixedSize(true); mRecyclerView.setLayoutManager(layoutManager); mRecyclerView.setAdapter(mRecentAdapter); floatingActionButton.setOnClickListener(click -> { if (_rxBus.hasObservers()) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/html"); if (titles.size() > 0 && text.size() > 0) { intent.putExtra(Intent.EXTRA_SUBJECT, titles.get(0)); intent.putExtra(Intent.EXTRA_TEXT, text.get(0)); } _rxBus.send(Intent.createChooser(intent, getString(R.string.send_email))); } }); ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(title); } Picasso.with(getContext()).load(drawable).error(R.drawable.dropcoverholdon).into(backdrop); } return rootView; }
From source file:com.goliathonline.android.kegbot.service.SyncService.java
@Override protected void onHandleIntent(Intent intent) { Log.d(TAG, "onHandleIntent(intent=" + intent.toString() + ")"); final ResultReceiver receiver = intent.getParcelableExtra(EXTRA_STATUS_RECEIVER); if (receiver != null) receiver.send(STATUS_RUNNING, Bundle.EMPTY); final Context context = this; final SharedPreferences prefs = getSharedPreferences(Prefs.IOSCHED_SYNC, Context.MODE_PRIVATE); final int localVersion = prefs.getInt(Prefs.LOCAL_VERSION, VERSION_NONE); try {/* ww w . ja v a 2s. c om*/ // Bulk of sync work, performed by executing several fetches from // local and online sources. final long startLocal = System.currentTimeMillis(); final boolean localParse = localVersion < VERSION_CURRENT; Log.d(TAG, "found localVersion=" + localVersion + " and VERSION_CURRENT=" + VERSION_CURRENT); if (localParse) { // Parse values from local cache first, since spreadsheet copy // or network might be down. //mLocalExecutor.execute(context, "cache-drinks.json", new RemoteDrinksHandler()); //mLocalExecutor.execute(context, "cache-speakers.xml", new RemoteSpeakersHandler()); //mLocalExecutor.execute(context, "cache-vendors.xml", new RemoteVendorsHandler()); // Save local parsed version prefs.edit().putInt(Prefs.LOCAL_VERSION, VERSION_CURRENT).commit(); } Log.d(TAG, "local sync took " + (System.currentTimeMillis() - startLocal) + "ms"); // Always hit remote spreadsheet for any updates final long startRemote = System.currentTimeMillis(); mRemoteExecutor.executeGet(PrefsHelper.getAPIUrl(getBaseContext()) + "/events", new RemoteJsonHandler(mRemoteExecutor)); Log.d(TAG, "remote sync took " + (System.currentTimeMillis() - startRemote) + "ms"); } catch (Exception e) { Log.e(TAG, "Problem while syncing", e); if (receiver != null) { // Pass back error to surface listener final Bundle bundle = new Bundle(); bundle.putString(Intent.EXTRA_TEXT, e.toString()); receiver.send(STATUS_ERROR, bundle); } } // Announce success to any surface listener Log.d(TAG, "sync finished"); if (receiver != null) receiver.send(STATUS_FINISHED, Bundle.EMPTY); }
From source file:com.samuelcastro.cordova.InstagramSharePlugin.java
private void shareVideo(String videoString, String captionString) { // Create the URI from the media File media = new File(this.getRealVideoPathFromURI(Uri.parse(videoString))); Uri uri = Uri.fromFile(media);// ww w .ja v a 2 s .c o m Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("video/*"); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); shareIntent.putExtra(Intent.EXTRA_TEXT, captionString); shareIntent.setPackage("com.instagram.android"); this.cordova.startActivityForResult((CordovaPlugin) this, shareIntent, 12345); }
From source file:com.ckchan.assignment1.ckchan_todolist.MainActivity.java
@Override //Selecting action bar items 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(); if (id == R.id.action_settings) { Settings();//from ww w . j ava2s . c o m return true; } //Handle presses on the action bar items switch (item.getItemId()) { case R.id.summary_info: SummaryInfo(); return true; case R.id.email_all: try { Context context = getApplicationContext(); TaskDatabase taskDatabase = new TaskDatabase(); ; Email email = taskDatabase.loadEmailAddress(context); ArrayList<TodoTask> taskArray = (ArrayList<TodoTask>) taskDatabase.loadTaskData(context); ArrayList<TodoTask> archiveArray = (ArrayList<TodoTask>) taskDatabase.loadArchiveData(context); //StringBuilder code from: //http://stackoverflow.com/questions/12899953/in-java-how-to-append-a-string-more-efficiently StringBuilder stringBuilder = new StringBuilder(); if (email != null) { Intent i = new Intent(Intent.ACTION_SEND); i.setType("message/rfc822"); i.putExtra(Intent.EXTRA_EMAIL, new String[] { email.getAddress() }); i.putExtra(Intent.EXTRA_SUBJECT, "Todo and Archive Tasks"); stringBuilder.append("Todo Tasks\n"); for (TodoTask task : taskArray) { stringBuilder.append(task.getTaskDescription() + "\n"); } stringBuilder.append("Archive Tasks\n"); for (TodoTask task : archiveArray) { stringBuilder.append(task.getTaskDescription() + "\n"); } String emailContent = stringBuilder.toString(); i.putExtra(Intent.EXTRA_TEXT, emailContent); try { startActivity(Intent.createChooser(i, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(context, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } default: return super.onOptionsItemSelected(item); } }