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.google.android.apps.paco.FeedbackActivity.java
private void sendEmail(String body, String subject, String userEmail) { userEmail = findAccount(userEmail);/*from w ww.j a v a 2 s .com*/ Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); String aEmailList[] = { userEmail }; emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body); emailIntent.setType("plain/text"); startActivity(emailIntent); }
From source file:info.guardianproject.gpg.KeyListFragment.java
private void keyserverOperation(final int operation, final ActionMode mode) { new AsyncTask<Void, Void, Void>() { final Context context = getActivity().getApplicationContext(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); final String host = prefs.getString(GpgPreferenceActivity.PREF_KEYSERVER, "ipv4.pool.sks-keyservers.net"); final long[] selected = mListView.getCheckedItemIds(); final Intent intent = new Intent(context, ImportFileActivity.class); @Override/*w w w . jav a2 s . c om*/ protected Void doInBackground(Void... params) { HkpKeyServer keyserver = new HkpKeyServer(host); if (operation == DELETE_KEYS) { String args = "--batch --yes --delete-keys"; for (int i = 0; i < selected.length; i++) { args += " " + Long.toHexString(selected[i]); } GnuPG.gpg2(args); } else if (operation == KEYSERVER_SEND) { String args = "--keyserver " + host + " --send-keys "; for (int i = 0; i < selected.length; i++) { args += " " + Long.toHexString(selected[i]); } // TODO this should use the Java keyserver stuff GnuPG.gpg2(args); } else if (operation == KEYSERVER_RECEIVE) { String keys = ""; for (int i = 0; i < selected.length; i++) { try { keys += keyserver.get(selected[i]); keys += "\n\n"; } catch (QueryException e) { e.printStackTrace(); } } // An Intent can carry very much data, so write it // to a cached file try { File privateFile = File.createTempFile("keyserver", ".pkr", mCurrentActivity.getCacheDir()); FileUtils.writeStringToFile(privateFile, keys); intent.setType(getString(R.string.pgp_keys)); intent.setAction(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(privateFile)); } catch (IOException e) { e.printStackTrace(); // try sending the key data inline in the Intent intent.setType("text/plain"); intent.setAction(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_TEXT, keys); } } return null; } @Override protected void onPostExecute(Void v) { GpgApplication.triggerContactsSync(); mCurrentActivity.setSupportProgressBarIndeterminateVisibility(false); mode.finish(); // Action picked, so close the CAB if (operation == KEYSERVER_RECEIVE) startActivity(intent); } }.execute(); }
From source file:com.mibr.android.intelligentreminder.INeedToo.java
@Override public Dialog onCreateDialog(int id) { switch (id) { case DIALOG_REMINDER_CONTACTS_SERVICE_FAILED_LICENSING: AlertDialog.Builder buildersvc = new AlertDialog.Builder(this); buildersvc.setMessage(/*from ww w .ja v a2 s .co m*/ "The Reminder Contact Service add-on that you've got installed is not a licensed version"); buildersvc.setCancelable(false) .setNeutralButton(R.string.msg_cus, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { String[] mailto = { "info@intelligentreminder.com", "" }; Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto); sendIntent.putExtra(Intent.EXTRA_SUBJECT, "".toString()); sendIntent.putExtra(Intent.EXTRA_TEXT, "".toString()); sendIntent.setType("text/plain"); startActivity(Intent.createChooser(sendIntent, "Send EMail...")); } }).setPositiveButton(R.string.msg_register, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { if (INeedToo.IS_ANDROID_VERSION) { String uri = getString(R.string.indeedtopayforservice); Intent ii3 = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); startActivity(ii3); } else { Uri uri = Uri.parse( "http://www.amazon.com/gp/mas/dl/android?p=com.mibr.android.remindercontacts"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } isReminderContactsAvailable = true; iDidReminderContacts = false; } }).setNegativeButton(R.string.msg_cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); AlertDialog alert = buildersvc.create(); return alert; case DOING_SAMPLE_NEEDS_DIALOG: if (allItems == null) { return null; } dialogDoingSamples = new Dialog(this); dialogDoingSamples.setOwnerActivity(this); dialogDoingSamples.setContentView(R.layout.ineedvoiceprogress); dialogDoingSamples.setTitle("Working ..."); ((Button) dialogDoingSamples.findViewById(R.id.needvoiceprogress_cancel)).setEnabled(true); ((Button) dialogDoingSamples.findViewById(R.id.needvoiceprogress_ok)).setEnabled(false); ; // dialogDoingSamples.show(); ArrayList stuff = new ArrayList(); stuff.add(dialogDoingSamples); stuff.add(getApplicationContext()); stuff.add(this); stuff.add(getLocationManager()); stuff.add(getDbAdapter()); stuff.add(allItems.get(whereImAtInAllItems)); stuff.add(new Integer(1)); new NeedByVoiceProgress().execute(stuff); return dialogDoingSamples; case DIALOG_SAMPLES: Dialog aDialog = null; AlertDialog.Builder builder2; LayoutInflater inflater2 = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); View layout2 = inflater2.inflate(R.layout.ineedsamples, (ViewGroup) findViewById(R.id.hijklmnop)); builder2 = new AlertDialog.Builder(this); builder2.setView(layout2); builder2.setTitle("Build Sample Data Set"); builder2.setPositiveButton("Okay", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { allItems = new ArrayList<ArrayList<String>>(); Boolean doit = false; StringBuilder sb = new StringBuilder(); StringBuilder sb2 = new StringBuilder(); StringBuilder sb3 = new StringBuilder(); int cnt = 0; Boolean dw = false; ArrayList<String> jdmatchesSS = null; ; sb.append("I need Print Cartridges description HP 28 and 48 "); if (mWalmart != null && mWalmart.isChecked()) { sb.append(" location Walmart "); dw = true; } if (mWalgreens != null && mWalgreens.isChecked()) { sb.append(" location Walgreens "); dw = true; } if (dw) { // they checked something doit = true; jdmatchesSS = new ArrayList<String>(); jdmatchesSS.add(sb.toString()); allItems.add(jdmatchesSS); cnt++; } if (mSevenEleven != null && mSevenEleven.isChecked()) { sb3.append("I need Energy Drink description Red Bull location 7-Eleven "); ArrayList<String> jdmatches = new ArrayList<String>(); jdmatches.add(sb3.toString()); allItems.add(jdmatches); cnt++; doit = true; } if (mStarbucks != null && mStarbucks.isChecked()) { sb2.append("I need Coffee description French Roast location Starbucks"); ArrayList<String> jdmatches = new ArrayList<String>(); jdmatches.add(sb2.toString()); allItems.add(jdmatches); cnt++; doit = true; } if (doit) { whereImAtInAllItems = 0; INeedToo.this.showDialog(DOING_SAMPLE_NEEDS_DIALOG); } } }); mWalmart = (CheckBox) layout2.findViewById(R.id.BuildWalmart); mWalgreens = (CheckBox) layout2.findViewById(R.id.BuildWalgreens); mSevenEleven = (CheckBox) layout2.findViewById(R.id.Build7Eleven); mStarbucks = (CheckBox) layout2.findViewById(R.id.BuildStarbucks); aDialog = builder2.create(); return aDialog; case DIALOG_SPLASH: /* jdd=new Dialog(mContext); jdd.setContentView(R.layout.ineed2splash); jdd.setTitle("W E L C O M E"); */ AlertDialog.Builder builder; LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.ineed2splashv2, (ViewGroup) findViewById(R.id.ScrollView01lmnop2)); builder = new AlertDialog.Builder(this); builder.setPositiveButton("Okay", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (mWantSample != null) { if (mWantSample.isChecked()) { showDialog(DIALOG_SAMPLES); } } } }); builder.setTitle("W E L C O M E"); if (getDbAdapter().thereAreSomeLocationsOnSystem()) { LinearLayout ll = (LinearLayout) layout.findViewById(R.id.CreateDefaultValues); ll.setVisibility(View.INVISIBLE); } else { mWantSample = (CheckBox) layout.findViewById(R.id.BuildDefaultValues); } builder.setView(layout); jdd = builder.create(); //Button butt=(Button)jdd.findViewById(R.id.Button01); /*butt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { jdd.cancel(); } }); */ break; default: return null; } return jdd; }
From source file:com.github.gorbin.asne.instagram.InstagramSocialNetwork.java
/** * Post photo to social network// w ww.ja va 2 s . c o m * @param photo photo that should be shared * @param message message that should be shared with photo * @param onPostingCompleteListener listener for posting request */ @Override public void requestPostPhoto(File photo, String message, OnPostingCompleteListener onPostingCompleteListener) { super.requestPostPhoto(photo, message, onPostingCompleteListener); String instagramPackage = "com.instagram.android"; String errorMessage = "You should install Instagram app first"; if (isPackageInstalled(instagramPackage, mSocialNetworkManager.getActivity())) { Intent normalIntent = new Intent(Intent.ACTION_SEND); normalIntent.setType("image/*"); normalIntent.setPackage(instagramPackage); File media = new File(photo.getAbsolutePath()); Uri uri = Uri.fromFile(media); normalIntent.putExtra(Intent.EXTRA_STREAM, uri); normalIntent.putExtra(Intent.EXTRA_TEXT, message); mSocialNetworkManager.getActivity().startActivity(normalIntent); } else { mLocalListeners.get(REQUEST_POST_PHOTO).onError(getID(), REQUEST_POST_PHOTO, errorMessage, null); } mLocalListeners.remove(REQUEST_POST_PHOTO); }
From source file:cn.ttyhuo.view.UserView.java
/** * /*from ww w . j av a 2 s .co m*/ * @param context * @param activityTitle Activity?? * @param msgTitle ? * @param msgText ? * @param imgPath ?null */ public static void shareMsg(Context context, String activityTitle, String msgTitle, String msgText, File f) { Intent intent = new Intent(Intent.ACTION_SEND); if (f == null || !f.exists() || !f.isFile()) { intent.setType("text/plain"); // } else { intent.setType("image/png"); Uri u = Uri.fromFile(f); //Uri u = Uri.parse(imgPath); intent.putExtra(Intent.EXTRA_STREAM, u); } intent.putExtra(Intent.EXTRA_SUBJECT, msgTitle); intent.putExtra(Intent.EXTRA_TEXT, msgText); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(Intent.createChooser(intent, activityTitle)); }
From source file:com.albedinsky.android.support.intent.EmailIntent.java
/** *///from w ww . j av a 2 s . c o m @NonNull @Override protected Intent onBuild() { final Intent intent = new Intent(Intent.ACTION_SENDTO, createUri(mAddresses)); intent.putExtra(Intent.EXTRA_SUBJECT, mSubject); intent.putExtra(Intent.EXTRA_TEXT, mMessage); if (mCcAddresses != null) { intent.putExtra(Intent.EXTRA_CC, addressesToArray(mCcAddresses)); } if (mBccAddresses != null) { intent.putExtra(Intent.EXTRA_BCC, addressesToArray(mBccAddresses)); } return intent; }
From source file:alaindc.memenguage.View.MainActivity.java
@SuppressWarnings("StatementWithEmptyBody") @Override/* w w w. j a v a 2 s . c o m*/ public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_home) { } else if (id == R.id.nav_settings) { Intent settingsActivity = new Intent(this, SettingsActivity.class); startActivity(settingsActivity); } else if (id == R.id.nav_send) { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, R.style.MyDialogTheme); builder.setTitle("Upload Database").setMessage("Are you sure?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { progressDialog.setTitle("Upload"); progressDialog.setMessage("Uploading to server... please wait"); progressDialog.show(); ServerRequests.uploadFile(personId, getApplicationContext().getDatabasePath(Constants.DBNAME), getApplicationContext()); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }).create().show(); } else if (id == R.id.nav_get) { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, R.style.MyDialogTheme); builder.setTitle("Download Database").setMessage("Are you sure?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { progressDialog.setTitle("Download"); progressDialog.setMessage("Downloading from server... please wait"); progressDialog.show(); ServerRequests.downloadFile(personId, getApplicationContext().getDatabasePath(Constants.DBNAME), getApplicationContext()); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }).create().show(); } else if (id == R.id.nav_share) { Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); String shareBody = "Memenguage, the best app on the world! Maybe."; sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Memento mori!"); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); startActivity(Intent.createChooser(sharingIntent, "Share via")); } else if (id == R.id.nav_signin) { Intent signinintent = new Intent(this, SignInActivity.class); signinintent.setAction(Constants.SIGNIN_LOGOUT); startActivity(signinintent); } else if (id == R.id.nav_play) { Intent playActivity = new Intent(this, PlayActivity.class); startActivity(playActivity); } else if (id == R.id.nav_stats) { Intent statsActivity = new Intent(this, StatsActivity.class); startActivity(statsActivity); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; }
From source file:aarddict.android.ArticleViewActivity.java
@Override public boolean onSearchRequested() { Intent intent = getIntent();/* w w w . ja v a2s.c om*/ String action = intent == null ? null : intent.getAction(); if (action != null) { String word = null; if (action.equals(Intent.ACTION_SEARCH)) { word = intent.getStringExtra("query"); } else if (action.equals(Intent.ACTION_SEND)) { word = intent.getStringExtra(Intent.EXTRA_TEXT); } if (word != null) { Intent next = new Intent(); next.setClass(this, LookupActivity.class); next.setAction(Intent.ACTION_SEARCH); next.putExtra(SearchManager.QUERY, word); startActivity(next); } } finish(); return true; }
From source file:com.dwdesign.tweetings.fragment.BaseStatusesListFragment.java
@Override public boolean onMenuItemClick(final MenuItem item) { final ParcelableStatus status = mSelectedStatus; if (status == null) return false; final long account_id = getDefaultAccountId(mApplication); switch (item.getItemId()) { case MENU_VIEW: { openStatus(getActivity(), status); break;//from ww w. j ava 2 s . c o m } case MENU_SHARE: { final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, "@" + status.screen_name + ": " + status.text_plain); startActivity(Intent.createChooser(intent, getString(R.string.share))); break; } case MENU_TRANSLATE: { translate(status); break; } case MENU_RETWEET: { if (isMyRetweet(status)) { mService.destroyStatus(status.account_id, status.status_id); } else { final long id_to_retweet = mSelectedStatus.is_retweet && mSelectedStatus.retweet_id > 0 ? mSelectedStatus.retweet_id : mSelectedStatus.status_id; mService.retweetStatus(status.account_id, id_to_retweet); } break; } case MENU_QUOTE: { final Intent intent = new Intent(INTENT_ACTION_COMPOSE); final Bundle bundle = new Bundle(); bundle.putLong(INTENT_KEY_ACCOUNT_ID, status.account_id); bundle.putBoolean(INTENT_KEY_IS_QUOTE, true); bundle.putString(INTENT_KEY_TEXT, getQuoteStatus(getActivity(), status.screen_name, status.text_plain)); intent.putExtras(bundle); startActivity(intent); break; } case MENU_QUOTE_REPLY: { final Intent intent = new Intent(INTENT_ACTION_COMPOSE); final Bundle bundle = new Bundle(); bundle.putLong(INTENT_KEY_ACCOUNT_ID, status.account_id); bundle.putLong(INTENT_KEY_IN_REPLY_TO_ID, status.status_id); bundle.putString(INTENT_KEY_IN_REPLY_TO_SCREEN_NAME, status.screen_name); bundle.putString(INTENT_KEY_IN_REPLY_TO_NAME, status.name); bundle.putBoolean(INTENT_KEY_IS_QUOTE, true); bundle.putString(INTENT_KEY_TEXT, getQuoteStatus(getActivity(), status.screen_name, status.text_plain)); intent.putExtras(bundle); startActivity(intent); break; } case MENU_ADD_TO_BUFFER: { final Intent intent = new Intent(INTENT_ACTION_COMPOSE); final Bundle bundle = new Bundle(); bundle.putLong(INTENT_KEY_ACCOUNT_ID, status.account_id); bundle.putBoolean(INTENT_KEY_IS_BUFFER, true); bundle.putString(INTENT_KEY_TEXT, getQuoteStatus(getActivity(), status.screen_name, status.text_plain)); intent.putExtras(bundle); startActivity(intent); break; } case MENU_REPLY: { final Intent intent = new Intent(INTENT_ACTION_COMPOSE); final Bundle bundle = new Bundle(); final List<String> mentions = new Extractor().extractMentionedScreennames(status.text_plain); mentions.remove(status.screen_name); mentions.add(0, status.screen_name); bundle.putStringArray(INTENT_KEY_MENTIONS, mentions.toArray(new String[mentions.size()])); bundle.putLong(INTENT_KEY_ACCOUNT_ID, status.account_id); bundle.putLong(INTENT_KEY_IN_REPLY_TO_ID, status.status_id); bundle.putString(INTENT_KEY_IN_REPLY_TO_TWEET, status.text_plain); bundle.putString(INTENT_KEY_IN_REPLY_TO_SCREEN_NAME, status.screen_name); bundle.putString(INTENT_KEY_IN_REPLY_TO_NAME, status.name); intent.putExtras(bundle); startActivity(intent); break; } case MENU_FAV: { if (mSelectedStatus.is_favorite) { mService.destroyFavorite(status.account_id, status.status_id); } else { mService.createFavorite(status.account_id, status.status_id); } break; } case MENU_CONVERSATION: { openConversation(getActivity(), status.account_id, status.status_id); break; } case MENU_DELETE: { mService.destroyStatus(status.account_id, status.status_id); break; } case MENU_EXTENSIONS: { final Intent intent = new Intent(INTENT_ACTION_EXTENSION_OPEN_STATUS); final Bundle extras = new Bundle(); extras.putParcelable(INTENT_KEY_STATUS, status); intent.putExtras(extras); startActivity(Intent.createChooser(intent, getString(R.string.open_with_extensions))); break; } case MENU_MULTI_SELECT: { if (!mApplication.isMultiSelectActive()) { mApplication.startMultiSelect(); } final NoDuplicatesLinkedList<Object> list = mApplication.getSelectedItems(); if (!list.contains(status)) { list.add(status); } break; } case MENU_BLOCK: { mService.createBlock(account_id, status.user_id); break; } case MENU_REPORT_SPAM: { mService.reportSpam(account_id, status.user_id); break; } case MENU_MUTE_USER: { final String screen_name = status.screen_name; final Uri uri = Filters.Users.CONTENT_URI; final ContentValues values = new ContentValues(); final SharedPreferences.Editor editor = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE).edit(); final ContentResolver resolver = getContentResolver(); values.put(Filters.Users.TEXT, screen_name); resolver.delete(uri, Filters.Users.TEXT + " = '" + screen_name + "'", null); resolver.insert(uri, values); editor.putBoolean(PREFERENCE_KEY_ENABLE_FILTER, true).commit(); Toast.makeText(getActivity(), R.string.user_muted, Toast.LENGTH_SHORT).show(); break; } case MENU_MAKE_GAP: { Uri uri = Statuses.CONTENT_URI; final Uri query_uri = buildQueryUri(uri, false); ContentResolver mResolver = getContentResolver(); final ContentValues values = new ContentValues(); values.put(Statuses.IS_GAP, 1); final StringBuilder where = new StringBuilder(); where.append(Statuses.ACCOUNT_ID + "=" + account_id); where.append(" AND " + Statuses.STATUS_ID + "=" + status.status_id); mResolver.update(query_uri, values, where.toString(), null); getActivity().sendBroadcast(new Intent(BROADCAST_FILTERS_UPDATED).putExtra(INTENT_KEY_SUCCEED, true)); break; } case MENU_COPY: { final CharSequence text = Html.fromHtml(status.text_html); if (ClipboardUtils.setText(getActivity(), text)) { Toast.makeText(getActivity(), R.string.text_copied, Toast.LENGTH_SHORT).show(); } break; } } return true; }