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.chatwing.whitelabel.managers.ChatboxModeManager.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem notificationItem = menu.findItem(R.id.manage_notification); if (notificationItem != null) { if (mCurrentChatBoxManager.getCurrentChatBox() == null || mCurrentChatBoxManager.getCurrentChatBox().getNotificationStatus() == null || mUserManager.getCurrentUser() == null) { notificationItem.setVisible(false); } else {//from ww w . j ava 2 s .c o m notificationItem.setVisible(true); } } MenuItem shareChatBoxItem = menu.findItem(R.id.share_chat_box); MenuItem copyAliasItem = menu.findItem(R.id.copy_alias); MenuItem manageBlackListItem = menu.findItem(R.id.manage_blacklist); MenuItem bookmarkChatBoxItem = menu.findItem(R.id.bookmark_chat_box); MenuItem onlineUsersItem = menu.findItem(R.id.online_users); // Invalidate all menu related objects onlineUsersItem.setVisible(false); mOnlineUsersBadgeView.hide(); shareChatBoxItem.setVisible(false); copyAliasItem.setVisible(false); manageBlackListItem.setVisible(false); bookmarkChatBoxItem.setVisible(false); mediaAddItem.setVisible(false); // Now config them if (mCurrentChatBoxManager.getCurrentChatBox() != null) { // When main view or online users drawer is opened // and current chat box is available. onlineUsersItem.setVisible(true); shareChatBoxItem.setVisible(true && Constants.ALLOW_SHARE_CHATBOX); if (mNumOfOnlineUser > 0) { mOnlineUsersBadgeView.setText(Integer.toString(mNumOfOnlineUser)); mOnlineUsersBadgeView.show(); } // Config share intent for share chat box item AppCompatActivity activity = mActivityDelegate.getActivity(); ChatBox chatBox = mCurrentChatBoxManager.getCurrentChatBox(); String shareText = mApiManager.getChatBoxUrl(chatBox.getKey()); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.message_share_chat_box_subject)); intent.putExtra(Intent.EXTRA_TEXT, shareText); ShareActionProvider shareChatBoxActionProvider = (ShareActionProvider) MenuItemCompat .getActionProvider(shareChatBoxItem); shareChatBoxActionProvider.setShareIntent(intent); if (mBuildManager.isOfficialChatWingApp() && mUserManager.userCanBookmark() && !ChatWingContentProvider .hasSyncedBookmarkInDB(activity.getContentResolver(), chatBox.getId())) { bookmarkChatBoxItem.setVisible(true); } if (mBuildManager.isSupportedMusicBox()) { mediaAddItem.setVisible(true); } if (chatBox.getAlias() != null && Constants.ALLOW_SHARE_CHATBOX) { copyAliasItem.setVisible(true); } if (mUserManager.userHasPermission(chatBox, PermissionsValidator.Permission.UNBLOCK_USER)) { manageBlackListItem.setVisible(true); } updateControlUI(chatBox); } return true; }
From source file:com.adkdevelopment.earthquakesurvival.ui.DetailFragment.java
/** * Sets a share intent on ShareActionProvider *//*w w w . j av a 2 s . c o m*/ private void setShareIntent() { if (mShareActionProvider != null) { Intent intent = new Intent(Intent.ACTION_SEND); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.earthquake_magnitude, mMagnitude) + "\n" + mDate + "\n" + mDescription + "\n" + mDistance + "\n" + getString(R.string.earthquake_depth, mDepth) + "\n" + mLink); mShareActionProvider.setShareIntent(intent); } else { Log.e(TAG, "ShareActionProvider is null"); } }
From source file:bander.notepad.NoteEditAppCompat.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();//from ww w.j a va 2 s.c om return true; case R.id.home: onBackPressed(); return true; case DELETE_ID: deleteNote(this, mUri); return true; case REVERT_ID: mBodyText.setTextKeepState(mOriginalNote.getBody()); return true; case SEND_ID: Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, mBodyText.getText().toString()); startActivity(Intent.createChooser(intent, getString(R.string.menu_send))); return true; case PREFS_ID: Intent prefsActivity = new Intent(this, PrefsActivityAppCompat.class); startActivity(prefsActivity); return true; } return super.onOptionsItemSelected(item); }
From source file:net.networksaremadeofstring.rhybudd.ViewZenossEventFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { getActivity().finish();/*from w w w . jav a 2s . co m*/ return true; } case R.id.AddLog: { try { addMessageDialog = new Dialog(getActivity()); addMessageDialog.setContentView(R.layout.add_message); addMessageDialog.setTitle("Add Message to Event Log"); ((Button) addMessageDialog.findViewById(R.id.SaveButton)) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AddLogMessage(((EditText) addMessageDialog.findViewById(R.id.LogMessage)).getText() .toString()); addMessageDialog.dismiss(); } }); addMessageDialog.show(); return true; } catch (Exception e) { BugSenseHandler.sendExceptionMessage("ViewZenossEventFragmentUpdate", "AddLog", e); return false; } } case R.id.escalate: { try { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); // Add data to the intent, the receiving app will decide what to do with it. intent.putExtra(Intent.EXTRA_SUBJECT, "Escalation of Zenoss Event on " + Title.getText()); String EventDetails = Summary.getText() + "\r\r\n" + LastTime.getText() + "\r\r\n" + "Count: " + EventCount.getText(); intent.putExtra(Intent.EXTRA_TEXT, EventDetails); startActivity(Intent.createChooser(intent, "How would you like to escalate this event?")); return true; } catch (Exception e) { BugSenseHandler.sendExceptionMessage("ViewZenossEventFragmentUpdate", "escalate", e); return false; } } default: { return false; } } }
From source file:in.shick.diode.submit.SubmitLinkActivity.java
private boolean defaultExtractProperties(Bundle extras, SubmissionProperties properties) { if (null == extras) { return false; }/*from w w w .j a v a2 s .co m*/ String url = extras.getString(Intent.EXTRA_TEXT); String title = extras.getString(Intent.EXTRA_SUBJECT); if ((null == url) || (null == title)) { return false; } try { new URL(url); } catch (MalformedURLException e) { return false; } properties.url = url; properties.title = title; return true; }
From source file:co.tinode.tindroid.ContactsFragment.java
private void handleItemClick(final ContactsAdapter.ViewHolder tag) { boolean done = false; if (mPhEmImData != null) { Utils.ContactHolder holder = mPhEmImData.get(tag.contact_id); if (holder != null) { String address = holder.getIm(); if (address != null) { Intent it = new Intent(getActivity(), MessageActivity.class); it.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP); it.putExtra("topic", address); startActivity(it);//from ww w .jav a2 s. c o m done = true; } if (!done && ((address = holder.getPhone()) != null)) { // Send an SMS with an invitation Uri uri = Uri.fromParts("smsto", address, null); Intent it = new Intent(Intent.ACTION_SENDTO, uri); it.putExtra("sms_body", getString(R.string.tinode_invite_body)); startActivity(it); done = true; } if (!done && ((address = holder.getEmail()) != null)) { Uri uri = Uri.fromParts("mailto", address, null); Intent it = new Intent(Intent.ACTION_SENDTO, uri); it.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.tinode_invite_subject)); it.putExtra(Intent.EXTRA_TEXT, getString(R.string.tinode_invite_body)); startActivity(it); done = true; } } } if (!done) { Toast.makeText(getContext(), R.string.failed_to_invite, Toast.LENGTH_SHORT).show(); } }
From source file:pl.bcichecki.rms.client.android.fragments.DevicesListFragment.java
private void performActionShare(final ActionMode mode, MenuItem item, final Device selectedDevice) { ShareActionProvider shareActionProvider = (ShareActionProvider) item.getActionProvider(); if (shareActionProvider != null) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType(AppConstants.CONTENT_TEXT_PLAIN); intent.putExtra(Intent.EXTRA_TEXT, new DeviceTextPrettyPrinterPrinter(getActivity()).print(selectedDevice)); shareActionProvider.setShareHistoryFileName(null); shareActionProvider.setShareIntent(intent); Log.d(TAG, "Device " + selectedDevice + " was succesfully shared."); }// w w w . j av a 2s .c om }
From source file:com.bushstar.htmlcoin_android_wallet.ui.RequestCoinsFragment.java
private void handleShare() { final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, determineHTMLcoinRequestStr(false)); startActivity(Intent.createChooser(intent, getString(R.string.request_coins_share_dialog_title))); }
From source file:com.bushstar.kobocoin_android_wallet.ui.RequestCoinsFragment.java
private void handleShare() { final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, determineKobocoinRequestStr(false)); startActivity(Intent.createChooser(intent, getString(R.string.request_coins_share_dialog_title))); }
From source file:aerizostudios.com.cropshop.MainActivity.java
@Override public void onMenuItemClick(View clickedView, int position) { if (position == 1) { AlertDialog.Builder alert = new AlertDialog.Builder(this); LayoutInflater inflater = (LayoutInflater) getApplicationContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.photo_quality, null); alert.setView(v);/*from w w w. ja v a 2s . c om*/ alert.setTitle("Select Photo Quality"); alert.setPositiveButton("OKAY", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (normal.isChecked()) { prefs = getSharedPreferences(prefName, MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putInt("res", 300); editor.commit(); } else { prefs = getSharedPreferences(prefName, MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putInt("res", 400); editor.commit(); } prefs = getSharedPreferences(prefName, MODE_PRIVATE); quality = prefs.getInt("res", 0); } }); alert.setNegativeButton("CANCEL", null); AlertD = alert.create(); AlertD.show(); normal = (RadioButton) AlertD.findViewById(R.id.normalQuality); high = (RadioButton) AlertD.findViewById(R.id.highQuality); Log.d("alert pref", "alert pref" + quality); if (quality == 300) normal.setChecked(true); else high.setChecked(true); } if (position == 2) { Uri uri = Uri.parse("market://details?id=" + getPackageName()); Intent myAppLinkToMarket = new Intent(Intent.ACTION_VIEW, uri); try { startActivity(myAppLinkToMarket); } catch (ActivityNotFoundException e) { Toast.makeText(this, " unable to find market app", Toast.LENGTH_LONG).show(); } } if (position == 3) { try { Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_SUBJECT, "CROP SHOP"); String sAux = "\nHey friends, Check out this COOL APP - CropShop - No Crop for Whatsapp and" + " Instagram. This app helps you post images on Whatsapp and Instagram without any need " + "of cropping them. It also adds Blur Effect to the Photos like Iphone and also" + " Instagram filters." + "This app allows you to share the photos" + " directly to Instagram,Facebook and Whatsapp from the App.\n" + "Download this app from the play store.\n"; sAux = sAux + "https://play.google.com/store/apps/details?id=aerizostudios.com.cropshop \n\n"; i.putExtra(Intent.EXTRA_TEXT, sAux); startActivity(Intent.createChooser(i, "choose one")); } catch (Exception e) { //e.toString(); } } if (position == 4) { startActivity(new Intent(this, Feedback.class)); } }